Is there a way to generate random parameter values in jMeter http request sampler or any other sampler?
23
votes
Not sure about that but you could generate your random values some other ways and put them into a csv file and use (CSV Data Set Config) in jmeter to load your data.
- justMe
I use this idea now, but it's not very convenient. I was hoping that there is a way to make it out of the box. anyway thanks for an answer.
- Rasalom
I think Alies Belik provided a solution to your question, however most of the time I'ld go with Razh's reply, as it's more desirable resource consumption wise.
- Dominik Antal
2 Answers
20
votes
You can try to use some of jmeter's functions to generate random value:
- __Random to generate random int:
${__Random(MIN, MAX}; - __RandomString to generate random string:
${__RandomString(LENGTH)};
as well as Random Variable config element for the same purpose.
20
votes
In JMeter, you can use counters to generate parameter values. Add your counter to the top of your test plan and choose initial, increment and maximum values. It will start counting automatically.
counter is in Pre Processors menu. You can use the counter values in HTTP samplers by using reference name. i.e. let's say your reference name is ref_counter then you can call its values in HTTP samplers with ${ref_counter}.