A Runscope API test is a group of one or more HTTP requests executed sequentially to evaluate the uptime, performance and correctness of an API. For each step in the test, you can define Assertions to validate response data and Variables to extract data to be used in subsequent requests.
A test Passes if all the assertions pass. A test Fails if any assertion fails, or another error is encountered like a network connection problem.
Tests can be run from the cloud or behind your firewall against any public or private API. When a schedule is configured, tests can be used for ongoing monitoring. After a test run completes, notifications can be sent via email, webhook, PagerDuty, Slack, and more.
After creating a test, you'll see an HTTP request step with a sample URL has been automatically created and added to your test:
Our sample URL is guaranteed to return a 200 OK status code. Later on, when building your own tests, you can define requests with your own methods, URLs, headers, parameters, or body content.
With a request step added, we can move on to defining expected response data. Click on the request to expand it, and view its details. Select Assertions, and add the following assertions (we've created one for the status code automatically):
The assertions are evaluated after the request is executed for every test run. If any assertion fails, the test will fail. For your tests, you can create assertions that check response time, JSON or XML content, HTTP response headers and more.
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.