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:
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, you can even combine API tests with UI tests in one load scenario. This approach helps you simulate the realistic load that hundreds of concurrent real users produce on your tested web service or web application. This is contrary to some other load testing tools that just make API calls without simulating a specific sequence of user actions.
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:
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.