NeoLoad – Random String Variable

‘Random String’ is a type of variable in NeoLoad to generate the text or string randomly. It is a simple type of string generator and its working is as same as ‘Random Integer‘. ‘Random String’ generates a letter or string of the given length range and help to simulate the random string logic in the performance test script. e.g. abc, wrwe, osre etc. You can generate a string of the maximum length of 1000 using the ‘Random String’ variable type.

The very common use of ‘Random String’ is to input a text while filling a form. Like First Name, Last Name, Address, Company etc.

Inputs of ‘Random String’ type variable

  1. Name: To provide the name of the variable to be used in the script. This is a mandatory input.
  2. Description: To describe the use of the variable. This is an optional input.
  3. Parameters: To configure the parameter setting:
    1. Minimum length: Specify the minimum value of the number range
    2. Maximum length: Specify the maximim value of the number range
    3. Predictable randomization: Check-mark this option to make the same sequence of the random string. This option helps to compare two identical tests.
  4. Value change policy: To define the setting when the next row (data) will be picked
    1. On each use (Default value)
    2. On each request
    3. On each page
    4. On each iteration
    5. 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:

  1. First Name
  2. Last Name
  3. Company
  4. Address

Now, we have to parameterize all the above attributes and feed the random string. So, we will define 4 ‘Random String’ variables which are fName, lName, compName and address. These four variables will generate a random string and pass in the request. The ‘Value change policy’ is set to ‘on each iteration’. Refer to the below screenshot for better understanding:

NeoLoad – Random String Variable - Setting
Figure 01

To use the variable, you have to write ${<variable name>} in the script.

Example: ${fName}, ${lName}, ${compName} and ${address}

NeoLoad – Random String Variable - Request
Figure 02

Note: You can also validate the variable by using the ‘Test’ option. The variable should return the value of the defined length.

NeoLoad – Random String Variable - Test
Figure 03

You may be interested:


Leave a Reply

Your email address will not be published. Required fields are marked *