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:

  1. In the main menu, click the Performance tab.
  2. Click Create Test.
  3. Click Performance Test. create a performance test

  4. Click the arrow for the URL / APIs Test.
    upload script
  5. Add requests. Enter the Request name and URL.
  6. (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.
    scenario definition and url
  7. (Optional) To select a different request method, expand the drop-down list.
    performance list of requests scenario
  8. (Optional) To duplicate or delete requests, click the dots menu.
    duplicate delete request
  9. On the left panel, edit the test name.
  10. (Optional) Enter the test Description and add Schedule. For more information about schedule, see Scheduling a Test.
    test name details

Add Details to a Test

The advanced options available in the Scenario Definition let you quickly create more complex URL/API tests.

add more test parameters

Add Query Parameters

The Query Parameters tab provides option fields for adding parameters to an API call for querying specific data.

Follow these steps:

  1. In Scenario Definition, click the Query parameters tab.
  2. Enter values into the Key and Value fields.

    Note: New lines are added automatically.

  3. (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.

values automatic url

Add Headers

Key and Value fields for adding HTTP headers to your API call may be required by your application server.

Follow these steps:

  1. In Scenario Definition, click the Headers tab.
    headers details
  2. Enter values into the Key and Value fields.

    Note: New lines are added automatically.

  3. (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:

  1. In Scenario Definition, click the Body tab.
    details body
  2. Enter the values.

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).
    body attach binary files

Add Assertions

Add assertions to verify the existence of specific data in the response.

Follow these steps:

  1. In Scenario Definition, click the Assertions tab.
  2. From the drop-down list, select the type.
    details assertions list
  3. Fill in the values and click Add.
    add assertion
  4. (Optional) Add multiple assertions.
    add more 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.

errors tab assertions

Extract Data from Responses

You can extract data from the response and store it in a variable for future use.

Follow these steps:

  1. In Scenario Definition, click the Extract from response tab.
  2. From the drop-down list, select the type.
    extract from response
  3. Enter the values and click Add.
    extract and add
  4. (Optional) Copy the variable.

    extract from response and copy

  5. (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}.
    pasted from regex

Configure Load

Follow these steps:

  1. Configure the load by specifying the total users, duration, and ramp up time. For more information, see Load Configuration.
  2. Configure the load distribution to decide where traffic will be coming from. For more information, see Load Distribution.
  3. Click Run Test to start the test or Debug Test to validate your test configuration. For more information about debugging, see Debug Test.
    run or debug

Additional Test Options

In addition to the required settings above, there are optional settings to further enhance testing.

For more information, see: