📜 ⬆️ ⬇️

Runscope: convenient to test API


The back-end does not always function as perfectly as specified in the API specification. For example, someone forgets to make a mandatory 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 most unpleasant.
Today I will talk about the tool that is used to identify such cases. This is a runscope .



How it works?


Runscope is a service for automated API testing. With it, you can send requests to the server and check the received answers according to predetermined criteria. The Runscope interface is intuitive if you have API specifications at hand.

1. Creating a request

Supported:


')
2. Installation checks

Assertions are used for checking server responses. To any part of the answer, you can put a check to your taste. For example, we ask for the user's balance, and we need to check this answer:

{ "balance":150 } 

In this situation, we can set the following Assertion:


Assertions support many comparisons. Here are some of them:


3. Using variables

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

Variables can be created before running 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 clause 1 of 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 .

Scripts allow:
1. Change variables after the query is executed.
2. Display any information in the log
3. Use the functions of all third-party libraries that Runscope supports.

An example of a script that is used in real testing:

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

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


5. View answers

After performing any test Runscope allows you to see the result of each query.


Important!
Runscope does not display answers that are larger than 1mb. If you want to see a picture using Runscope, then this will cause problems.

After creating a few requests, we get a full-fledged test, which you can run with the big green “Run Now” button.


What else can Runscope?


1. Good to write documentation .
2. Run tests on a schedule.
3. Automatically collect the performance statistics of all tests.
4. Send notifications about the tests conducted by mail.
5. Join a third-party service and use its additional features. For example, automatically run a test after a commit in GitHub.
6. Run tests from different locations. Runscope provides several proxy servers scattered around the world and conducts tests with them.
7. Run tests remotely using 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


Price policy in Runscope determines only the number of users per organization and the number of requests per month. For exceeding the limit of requests, you must pay extra (about 0.30 cents per 1000 requests).
But you can stay on a free account.

Results


Runscope is actively developing and often rolls out new features. The service is extremely simple, and not all its functionality is described in this article. We at Redmadrobot work with him not only QA, 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 the server output on a specific device, we use Charles:
Charles: an indispensable tool in the arsenal of a QA-engineer

Source: https://habr.com/ru/post/253777/


All Articles