Is there a way to generate random parameter values in jMeter http request sampler or any other sampler?
Asked
Active
Viewed 2.9k times
25
-
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 Jan 16 '13 at 11:11
-
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 Jan 16 '13 at 11:36
-
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 Aug 09 '14 at 18:22
2 Answers
21
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}
.

roschach
- 8,390
- 14
- 74
- 124

Kerim Karaca
- 385
- 3
- 11
-
1thanks, with counter config element I found random config element, that was exactly what I needed. – Rasalom Jan 16 '13 at 12:31
-
@Rasalom, Just for correctness you should accept Alies Belik answer and upvote Kerim Karaca as it helped you. Because the aim of SO is to find the right answer – UBIK LOAD PACK Jan 16 '13 at 22:27
21
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.

Aliaksandr Belik
- 12,725
- 6
- 64
- 90