Pages

Monday 30 January 2017

JMeter - Config Element - "Random Variable"

"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 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" element?
You can follow steps to add Random Variable config element:
1. Select "Test Plan" node
2. Right click on "Test Plan" node
3. Mouse hovers "Add"
4. Mouse hovers "Config Element"
5. Click "Random Variable" 


How to remove "Random Variable" element?
You can follow steps:
1. Select "Random Variable" node
2. Right click on "Random Variable" node
3. Click "Remove" (Mouse) or "Delete" button from the keyboard
4. Click "Yes"

What are the attributes of "Random Variable" element?
"Random Variable" has attributes:
  • Name: To provide element name
  • Comments: To provide arbitrary comments (if any)
  • Variable Name: The name of the variable to store the generated random value. The value can be called using the same variable name anywhere in the test script. Example: ${rand_CustomerID}.
  • Output Format: You can specify the format of the string. In the above example; if 12345 value is randomly generated then cust12345 will be the string. If nothing is specified then randomly generated value will be passed as it is.
  • Minimum Value: The minimum value of random number range.
  • Maximum Value: The maximum value of the random number range.
  • Seed for random function: The seed for the random number generator. The default is the current time in milliseconds. If you use the same seed value with Per Thread set to 'true', you will get the same value for each Thread.
  • Per Thread(User): If it is 'False', then the generated value will be shared between all threads in the thread group. If it is 'True', then each thread has its own value.
Next Topic:
Apache JMeter - "Simple Config Element"

Previous Topic:
Apache JMeter - "Login Config" Element

Related Topics:

No comments:

Post a Comment