‘Random Integer’ is a type of variable in NeoLoad to generate the integer number randomly. It is a simple type of number generator within the given range and helps to simulate the random number logic in the performance test script. e.g. 10, 155, 26, 30 etc.
The very common use of ‘Random Integer’ is to input a number while filling a form. Like Age (Number Range 18 to 60), Weight (Number Range 40 to 120), Heigth (Number Range 50 to 250) etc.
Inputs of ‘Random Integer’ type variable
- Name: To provide the name of the variable to be used in the script. This is a mandatory input.
- Description: To describe the use of the variable. This is an optional input.
- Parameters: To configure the parameter setting:
- Minimum value: Specify the minimum value of the number range
- Maximum value: Specify the maximum value of the number range
- Predictable randomization: Checkmark this option to make the same sequence of the random number. This option helps to compare two identical tests.
- Value change policy: To define the setting when the next row (data) will be picked
- On each use (Default value)
- On each request
- On each page
- On each iteration
- For each Virtual User instance
Example
Consider, a personal detail submission form where a person needs to fill in his/her details. The form contains the following fields:
- Name
- Age
- Pin Code
The person name can be parameterized with the ‘Random String’ variable type, but to parametrize ‘Age’ and ‘Pin Code’; ‘Random Integer’ is the best option. Create two random integers and give the names ‘age’ and ‘pinCode’. The ‘Value change policy’ is set to ‘on each iteration’. Refer to the below screenshot for a better understanding:
To use the variable, you have to write ${<variable name>} in the script.
Example: ${age} & ${pinCode}
Note: You can also validate the variable by using the ‘Test’ option. The variable should return the correct value as per the defined range.
You may be interested: