Variables in JMeter

Variables in the life span of JMeter, there are defualt variables and options to add user defined variables, this article is an overview of the JMeter variables.

Random Variables

It is a jmeter element that is used to generate random variables. The same process can be performed by using __Random() function along with UDV , but using random variables is less tedious. There are the following fields:

Name: The field is used to name the random variable.

Comments: It is not mandatory , it can be used to add general comment about the variable.

Variable name: the field should contain the name of the variable which would be used in the testplan.

Output format: the field defining output structure.

Minimum value:the value in this field should set the lower limit on the variable output. The values are of long type.

Maximum value: the value in this field sets an upper limit on the output of the random variable. The values are of long type.

User Defined Variable

The jmeter has the capacity to define user variables which can be used by the thread in the test. There are 3 columns inside the user defined variables element, namely, Name, Value and Description. To add or define a new variable, the user should click on add button which will create a new row. The name of the variable will come under the name column, similarly, the value under the value column. The user can also add description of the variable under the description but it is not mandatory.

The user defined variables are processed in the beginning of the test and their values are provided to the thread. If we define a pre-processor or regular expression extractor with the same name as that of UDV, then the value of that variable is updated and reflected inside the test. Add from clipboard: if we want to copy data from some excel files , we can transfer or copy the same using the ‘add from clipboard’ button.