Creating a URL/API Performance Test
Creating a new URL/API Test in BlazeMeter is as simple as performing a single GET to a URL. When a more advanced test is needed, the URL/API Test Scenario Definition provides a range of advanced options. The automatic scripting feature generates a Taurus YAML script that executes a JMeter test in where each virtual user will hit each URL sequentially. Each virtual user has their own browser session, cache, and cookies.
To record complex scripts directly from your Google Chrome browser, use the Chrome Extension or Proxy Recorder.
Create a Test
Follow these steps:
- In the main menu, click the Performance tab.
- Click Create Test.
- Select a project.
- Click Performance Test.
- Click the arrow for the URL / APIs Test.
- Add requests. Enter the Request name and URL.
- (Optional) If you want to run multiple API calls, you can create a sequential chain of multiple requests. To add more requests, click + in the Scenario Definition section.
- (Optional) To select a different request method, expand the drop-down list.
- (Optional) To duplicate or delete requests, click the dots menu.
- On the left panel, edit the test name.
- (Optional) Enter the test Description and add Schedule. For more information about schedule, see Scheduling a Test.
Add Details to a Test
The advanced options available in the Scenario Definition let you quickly create more complex URL/API tests.
Add Query Parameters
The Query Parameters tab provides option fields for adding parameters to an API call for querying specific data.
Follow these steps:
- In Scenario Definition, click the Query parameters tab.
- Enter values into the Key and Value fields.
New lines are added automatically.
- (Optional) To delete an entry, click the bin icon on the right.
BlazeMeter creates the API call automatically appending the parameters to the end of the URL.
Example:
The API endpoint https://api.demoblaze.com/entries allows the use of the Name, Name2 and Name3 keys to query name values. BlazeMeter creates: https://api.demoblaze.com/entries?Name=Value&Name2=Value2&Name3=Value3.
Add Headers
Key and Value fields for adding HTTP headers to your API call may be required by your application server.
Follow these steps:
- In Scenario Definition, click the Headers tab.
- Enter values into the Key and Value fields.New lines are added automatically.
- (Optional) To delete an entry, click the bin icon on the right.
Add Body
The Body tab only appears if the request type allows sending body data. For example, for a GET request, there will be no Body tab available.
Follow these steps:
You can enter body data in the following formats:
- Key Value - If the application server requires body data to be sent via specific keys.
- Text - For entering raw text, such as JSON content.
- Content from file - If you have a file containing the required body data, upload it here.
- Attach binary files - This option consists of three fields: a parameter name field, an option to upload a file for the parameter, and a field for providing the mime-type (determined automatically if let blank).
Add Assertions
Add assertions to verify the existence of specific data in the response.
Follow these steps:
- In Scenario Definition, click the Assertions tab.
- From the drop-down list, select the type.
- Fill in the values and click Add.
- (Optional) Add multiple assertions.
If you add a Text assertion, BlazeMeter automatically changes the assertion to a Regex type and checks the body for the entered value.
If an assertion fails, it shows under the Errors tab in the test report. Click the Assertion Name tab to review the failures.
Extract Data from Responses
You can extract data from the response and store it in a variable for future use.
Follow these steps:
- In Scenario Definition, click the Extract from response tab.
- From the drop-down list, select the type.
- Enter the values and click Add.
- (Optional) Copy the variable.
- (Optional) You can then paste the variable into another request, to add it to a URL or other request field. The variable will show in the format of ${variable}.
Configure Load
Follow these steps:
- Configure the load by specifying the total users, duration, and ramp up time. For more information, see Load Configuration.
- Configure the load distribution to decide where traffic will be coming from. For more information, see Load Distribution.
- Click Run Test to start the test or Debug Test to validate your test configuration. For more information about debugging, see Debug Test.
Additional Test Options
In addition to the required settings above, there are optional settings to further enhance testing.
For more information, see: