In your Test Cases,  If some of the Test Data is fetched dynamically from an API Endpoint, we might need to save the Test Data temporarily and use it in subsequent Test Steps. Therefore, Testsigma allows you to fetch data or perform actions via REST API calls along with normal Test Steps so as to provide maximum flexibility and control in your tests. 

Let us see how we can save information that is needed in later steps to Test Data(Runtime, Global, or Parameter Test Data) from a REST Response.

For this example, let us consider the Response for a simple GET request to https://app.testsigma.com. It returns the following Header response:

Server : Apache/2.4.6 (CentOS)
X-Content-Type-Options : nosniff
Connection : keep-alive
Pragma : no-cache
Date : Thu, 09 Aug 2018 06:42:19 GMT
X-Frame-Options : DENY
Cache-Control : no-cache, no-store, max-age=0, must-revalidate
Set-Cookie : JSESSIONID=D428960F53C951DFDE07F9C39322CF80; Path=/; HttpOnly
Expires : 0
Content-Length : 6014
X-XSS-Protection : 1; mode=block
Content-Language : en-US
Content-Type : text/html;charset=ISO-8859-1

Info: The Response Body contains the HTML content for the login page but that's not relevant for us now. Let us concentrate on the Header Response we have received.

Steps for storing Run-time Test Data from Response

Below given is a sample REST Step:

Please check the below article for more details on creating a REST Step - How to add Test Steps for Web Service/API Testing?

After selecting the required options for your normal REST API Call, please check the bottom half of the REST Step.

1. At the bottom of the REST Step, check the check boxes for the corresponding Response Content we need to save Test Data from. Check any one/both Store Header Content from Response and Store Body Content from Response check boxes if you want to save values from any one/both Response Header and Response Body.

2. Enter a name for the Run-time parameter which we are going to create and in which we will be storing the value of evaluated entity for JSONPath expression given in value column.

3. Enter the JSON Path expression that needs to be evaluated to find the entity inside the Response whose value we need to store in the run-time parameter created from Step 2. If the Response contains a flat key-value pair instead of a JSON Object, you can simply use the key name here.

Please check this article to know more about JSONPath and its usage - Comparison Modes in Web Services Testing


Let us assume we need to use the property named Server from the Header Response of the above API Call in an upcoming Test Step as Test Data. We can do that by saving the value in a Run-time variable using Store Header Content from Response option in RESTful API Steps as shown below:

In a normal REST API Step, we need to do the following to store the value of a key into a Runtime variable:

1. Check the checkbox Store Header Content from Response since we are going to save Test Data only from Response Header in our case.

2. Enter the name servername for the run-time variable we are about to create.

3.  Since in our case, our Response Header contains a flat key-value pair, we are simply using the name of the key i.e Server whose value is the server name we need to store.

Once the Test is run, the response given on the top of the page will be received and Testsigma will evaluate the expression given in value field to get the key name whose value is to be stored. Once the key name is evaluated, it will store the value of the key inside the newly created run-time parameter with name servername.

That's all we need to do for storing run-time parameters from REST API Test Steps.

For using previously store Run-time Test Data in REST API Test Steps, please check this article - Using Run-time Test Data in REST API Test Steps in Testsigma