Notes: JMeter and Azure Load Testing
azure jmeter load-testing

A couple of notes from working with JMeter and the Azure Load Testing service.
November 1, 2022

A couple of notes collected when creating load tests with JMeter and the Azure Load Testing service.

Parametrized runs

Add User Defined Variables, specify a variable and add this function call as the Value:

${__BeanShell( System.getenv("target_url") )}

When creating the load test run, specify environment vairables like this:


Use output from an HTTP call as a variable in other steps

A common scenario when moving to more dynamic tests:

  1. Fetch a list of items from an API as JSON.
  2. Pick random item from this list.
  3. Do something (another HTTP call) with this item, based on the item ID.

Since database records typically have their IDs auto-generated, it's not convenient to hardcode those in the test data, especially when step 1 gets the current list anyway.

Instead, the JSON Extractor post-processor can be used:


The post-processor creates a variable catalogItemId, based on the JSON Path (i.e. id) and selects a random match in the list. The variable can be then referenced in the subsequent steps. Each run of the loop will get its own.

Then the following steps can use it as a normal variable:


Random value in a request body

HTTP request body data can contain JMeter function calls too:

	"rating": "${__Random(1,5)}"

Found something inaccurate or plain wrong? Was this content helpful to you? Let me know!