Runscope: a convenient tool for testing API

  • Tutorial

The back-end does not always function as perfectly as specified in the API specification. For example, someone forgets to enter the required parameter in the output JSON string, or instead of "0" decides to enter null. If such data penetrates the mobile application, the consequences can be the most unpleasant.
Today I will talk about a tool that is used to identify such cases. This is Runscope .

How it works?

Runscope is a service for automated API testing. With it, you can send requests to the server and check the responses received according to predefined criteria. Runscope's interface is intuitive if you have API specs on hand.

1. Create a request

The following are supported:
  • HTTP verb. All necessary methods (GET, HEAD, POST, PUT, PATCH, OPTIONS, DELETE)
  • Login / password and OAuth authorization
  • Change Headers
  • Querystring parameters that are immediately substituted in the URL
  • Normal parameters that are sent as body

2. Installation of checks

Assertions are used to check server responses. You can put a check to your taste to any part of the answer. For example, we request a user balance, and we need to check this answer:


In this situation, we can set the following Assertion:

Assertions support many comparisons. Here is some of them:

3. Use of variables

If you need to use the same data in several queries in a row, you can create variables.

Variables can be created prior to the test:

Or during the test, you can take part of the answer and use it as a variable:

The created variables appear on the Request tab in the upper right corner (see section 1 Creating a Request). In order for them to appear in your request, you just need to click on them.

4. Using scripts

Scripts are not used in every request, but they provide incredible testing flexibility. Scripts are written in JavaScript. The main tool is the Chai Assertion Library .

The scripts allow you to:
1. Change the variables after executing the request
2. Output any information to the log
3. Use the functions of all third-party libraries that Runscope supports

Example of a script that is used in real testing:

variables.get (“token”) gets Runscope a variable that was created on the Variables tab.

As a result, the following information is displayed in the log:

5. View responses

After running any test Runscope allows you to see the result of each request.

Runscope does not display responses larger than 1mb. If you want to see a picture using Runscope, then this will cause problems.

After creating several queries, we get a full-fledged test, which can be launched with the big green “Run Now” button.

What else can Runscope do?

1. It’s good to write documentation .
2. Run tests on a schedule.
3. Automatically collect performance statistics from all tests.
4. Send notifications of tests performed to the mail.
5. Join a third-party service and use its additional features. For example, automatically run a test after a commit on GitHub.
6. Run tests from different locations. Runscope provides several proxy servers scattered around the world and conducts tests from them.
7. Run tests remotely using the Trigger URL. In fact, you just need to go to a special URL from any device, and the test will begin.
8. Save the results of previous tests if you do not want to watch them right now.

The most important thing

Runscope's pricing policy determines only the number of users per organization and the number of requests per month. For exceeding the limit of requests it is necessary to pay separately (about 0.30 cents per 1000 requests).
But you can stay on a free account.


Runscope is actively developing and often rolling out new features. The service is extremely simple, and not all of its functionality is described in this article. At Redmadrobot, not only QA works with him, but also developers and business analysts. Now we use Runscope to test new and old APIs, to view JSON strings in a convenient format and to collect logs for different accounts.

To intercept server output on a specific device, we use Charles:
Charles: an indispensable tool in the arsenal of a QA engineer

Also popular now: