Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate 'Random number' variables in JMeter

Is it possible to generate 'Random number' variables in JMeter?

  1. I have recorded a user journey
  2. I have imported the journey into JMeter
  3. I have to type in a unique 4digit id within my user journey test case
  4. Its default to 2323 at the moment in jmeter

Is there a way of generating a random 4didgit number? For example thread1: ID: 2323 thread2: 3334 thread3: 5643

Please refer to images below:

image1image2

like image 891
xGIx Avatar asked Jul 26 '17 13:07

xGIx


People also ask

How to generate random integer value from string in JMeter?

In JMeter, ‘Random Variable’ config element is used to generate random integer value between a specified range for each iteration. The generated value can be concatenated with a string which is stored in a variable as a string. Refer to the below screenshot, in which ‘rand_CustomerID’ is a random variable which will store a string value like ...

What is ‘Rand_CUSTOMERID’ in JMeter?

Refer to the below screenshot, in which ‘rand_CustomerID’ is a random variable which will store a string value like custXXXXX; where XXXXX is any random value between 1 to 99999: How to add ‘Random Variable’ in JMeter?

How to use the random variable config element?

The Random Variable config element allows you set the following parameters: Variable name: You can provide the name of the variable that can be used in your test plan elements. The random value will be stored in this variable. Format String: You can specify the format of the generated number. It can be prefixed or suffixed with string.

How to use random variables in test plan elements?

The Random Variable config element allows you set the following parameters: Variable name: You can provide the name of the variable that can be used in your test plan elements. The random value will be stored in this variable. Format String: You can specify the format of the generated number.


1 Answers

Use Random JMeter function

${__Random(0000,9999)}

The random function returns a random number that lies between the given min and max values.

  • Third parameter can be used as a variable name to save random value
like image 129
user7294900 Avatar answered Oct 07 '22 01:10

user7294900