API Tests

Last modified on November 15, 2022


An API test is a series of API requests. Usually, it corresponds to the sequence of API calls a client application sends to a web service. For example, a sequence of calls for an online ticketing system can include the following steps:

  • Log in

  • Search for an event

  • Specify purchase details

  • Check out and log off

A single API test corresponds to one such procedure. Each virtual user simulates this or that API test. A load test runs multiple virtual users concurrently to simulate simultaneous interaction of multiple users with a web service. You can create load scenarios that run hundreds of virtual users to simulate a huge load on the service. These virtual users can run different API tests. This approach helps you simulate the realistic load that hundreds of concurrent real users produce on your tested web service or web application.

API tests vs. UI tests

UI tests consist of individual user actions. They test a web application by replaying users actions like mouse clicks or data input on tested web pages. These tests simulate real users working with web pages.

API tests simulate calls of API methods of the tested web server. This kind of tests correspond to a client app working with the tested server.

Create an API test

You create API tests manually in the API test editor. Your project in LoadNinja can contain any number of API tests.

For complete information, see Create an API Test.

The API test editor

Here is a sample view of the editor:

API test editor

Click the image to enlarge it.

An API test consists of individual requests (or test steps). You can see them on the left side of the editor. To change their order, simply drag a test step to the desired position on the list.

In the central part of the editor, you specify the test step name, the HTTP method and URL of the request, request headers, body, parameters, and authentication settings (if they are used). The body tab is hidden if the HTTP method (for example, GET or DELETE) doesn’t imply using the request body. As for parameters, you can create and edit them on the Parameters tab or mention them in the URL.

Click Send to test how the request works and to get response data. You can see the response status code, time, and content on the right.

View existing tests

To view the list of API and UI tests of your project, go to Projects, click your project on the list, and then switch to the Tests tab.

List of scripts

Click the image to enlarge it.

More information on API tests

See Also

LoadNinja Documentation
UI Tests (or Scripts)

Highlight search results