Runscope Primer – Using Runscope for API testing

Runscope is one of the popular solutions for API performance testing, monitoring and debugging. Runscope helps in creating, managing and executing functional API tests and monitors.

Runscope Primer - Using Runscope for API testing

The most common use case where Runscope is used is to test the API. You can execute one or more HTTP requests sequentially to evaluate the performance, up time and correctness. 

Users can define Assertions for each request; a test passes if all the assertion pass, a test fails if any of the assertion fail. Also users can schedule test can be used for ongoing monitoring.

One can define an assertion in a way which should have source and target values. Users can compare the extracted data with the target value.

User can create a test case as shown in below image

Using Run-scope for API testing create a test case

After creating a test you will see a request step like below

After creating a test you will see a request step

From here, you can give Endpoint url to test with request types either Get, Post, Put etc;

You can define assertion by clicking on Assertion tab which has to compare target value with the requested value

If the request passes we get a status code of 200 for that request. If the request is bad we will get the status code of 400.

Variables

You can define a variable which can be used in a subsequent request and also for storing a value. We can define a variable in two ways

  1. Local variable
  2. Environment  variable

Local variable will be used for only one request in a defined place and on the other hand, environment variable is used for all the request that can define in a Test i.e, we can inherit and use in another request

Pre request script

From here you can add a script that can be used to run initially. For example, if you want to clear a header value which is coming from environment variables before executing a request

delete request.headers[“your_header’];

This line of script is used to delete a header for that request.

Post response script

You can add a script which should be run after the request executed. For example, if you want to store an Id of record that can use in another request of a test.

Headers, Body, and Authentication can be added in a single request

You can create a condition before executing a request. If the condition passes, then that particular request can execute

create a condition before executing a request

You can use one request as subtest to another request by clicking on add step

use one request as subtest to another request by clicking on add step
Run your test

Click Save & Run to start a new test run. The request will be executed and upon completion, each assertion will be checked. If everything checks out, you should see that the test run Passed. Select the test run from the results list to view the full HTTP request, response, and test output.

Refer below image to know the details

Select the test run from the results

Speak Your Mind

*