API Load Testing
WebLOAD API load testing tool
WebLOAD offers several different ways to create a REST API testing script – each is better in a different scenario, so pick the one that most suits your needs.
Testing REST API Performance
1. Record API Scripts
When to use: If there is an existing website or testing page that uses theAPI, the simplest way is to record the script like any other website – WebLOAD will automatically include all the needed requests details, authentication, headers, etc. Also, WebLOAD will automatically correlate the requests, so if one request relies on a previous response, WebLOAD will automatically make sure to use the new data.
2. In Web UI – from the WebLOAD Dashboard
When to use: Mostly for simple scenarios when there is a single scenario or a few simple requests need to be simulated
Use the WebLOAD Dashboard web based UI to directly enter the request URL and request parameters and immediately run a load test on this request.
In addition WebLOAD supports WebDAV (Web-based Distributed Authoring and Versioning), the HTTP protocol extension which enables the collaborative editing and management of files on remote web servers. WebLOAD seamlessly records and replays WebDAV requests and commands such as COPY, MOVE, LOCK, etc.
3. In script UI API testing
When to use: When adding an API request to a WebLOAD script – either existing or new.
Add an HTTP request through the UI API performance testing tool to get the request syntax right. A request can be added to an existing script, even if it was recorded or manually created.
Requests that are created using this UI are added to the script and can be further edited and extended using code if needed.
4. In coded Script
When to use: For full, manual control.
WebLOAD API performance testing allows you to define the full script test by code. This is useful if you know exactly what you want to do. This method can also be used with any of the other options – create a script in whatever way and then enhance it manually.
For example: Perform GET request: wlHttp.Get(“http://myurl?param1=something”) More complete example – wlHttp.Header[“x-my-custom-header”] = “some values” wlHttp.ContentType = “application/x-www-form-urlencoded” wlHttp.FormData[“user”] = “test” wlHttp.FormData[“password”] = “test” wlHttp.Post(“https://myurl”)
You can add code to extract values for correlation, parameterize the script, and validate the responses. Our script engine is JavaScript so can easily add code for loops, if-statements, etc.
For example: Perform GET request: wlHttp.Get(“http://myurl?param1=something”) More complete example – wlHttp.Header[“x-my-custom-header”] = “some values” wlHttp.ContentType = “application/x-www-form-urlencoded” wlHttp.FormData[“user”] = “test” wlHttp.FormData[“password”] = “test” wlHttp.Post(“https://myurl”)
You can add code to extract values for correlation, parameterize the script, and validate the responses. Our script engine is JavaScript so can easily add code for loops, if-statements, etc.
5. From Postman
When to use: If you already have the API calls(s) set up in Postman
WebLOAD can capture API calls made with Postman and generate the script in WebLOAD syntax.
This approach has the advantage of being a recorded script, so we capture all the request and response data and can automatically correlate between different requests.
This approach has the advantage of being a recorded script, so we capture all the request and response data and can automatically correlate between different requests.