Adding API Step to a Test

Updated 3 weeks ago by Rajesh Manyam

Test cases are not just a set of steps performed on your screen. Today, test cases require creating run time test data from API responses and using that data in subsequent steps (or deleting data after the test has completed execution). This makes automated tests reusable and resilient.

To add an API Step to Test, complete the following steps:

a.) Click the API Step Icon

  1. Please note: This will only be enabled when the user is recording an automated test.
  2. Click the API Step Icon. This will cause the Add API Step Modal dialog to appear.

b.) API Step Configuration

Next, specify the Request URL and select the type of Request. Sofy currently supports the following:

  1. GET
  2. POST
  3. PUT
  4. PATCH
  5. DELETE

c.) API Step Variable

You can save the API response in a variable and use it inside the API Step Dialog in the body, as well as in headers, query parameters, and path variables.

  • Add the URL, choose a request type, and click "send". By clicking on the path or value of the response, the user can store the path in a user-created variable. This variable has value later in the lab run. Finally, click add a step to successfully save the variable.

To use it in the body in a Post, Put, or Patch Request, wrap the API Step Variable (run time test variable) by adding double curly brackets in a string. It should look the following: “{{variable}}”.

  • To use the API Step Variable in Query Parameters, click on the "+" icon and add the name and value of the query parameter. In the value, a list of the saved API Variables appears, allowing you to choose your desired variable. Users can also type any value for query parameters instead of choosing an API variable. Click on the tick button to add this Param in the URL. Finally, click the "send" button to receive a response.

  • For using an API Step Variable in Path Variable, just click the "+" icon and choose the variable that appears under suggestions. Again, the user can type any text here if there's no desire to choose a variable. Click on the tick button to add this Param in the URL. Lastly, click "send" button to receive a response.


How did we do?