I'm sure I've already done this in the past but somehow I cannot figure out how ;-) So, here's my problem:
I'm trying to create a JUnit test plan in which a HTTP request is modified each iteration by altering a specific parameter. So, for example in five iterations I want the following HTTP requests to be made:
http://localhost:8080/test/foo.html?id=1 http://localhost:8080/test/foo.html?id=2 http://localhost:8080/test/foo.html?id=3 http://localhost:8080/test/foo.html?id=4 ...
I want to configure the identifier values globally for the test plan and use them within the HTTP request samplerer like this:
Path: /test/foo.html?id=${categoryId}
The question now: How do I configure the identifiers values globally (I do not want to use StringFromFile
) and how do I reference them in the sampler?
The value(s) which is extracted can be stored in any variable and can be a reference in any further request in the test plan. Values can be extracted from the response body, header, URL, response code, and other provided fields when you add this processor.
The __Random function will give you an index for your interval. To obtain values from 1 to 5, you have to call __Random(1,6,) , as it will never reach the MAX value. The __V function, will obtain the value of the variable with the given name.
There are several ways you can do this.
Given you have an array of values you could:
You reference them exactly as you have listed: ${varName}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With