NeoLoad – Counter Variable

‘Counter’ is a type of variable in NeoLoad to generate the value which maintains the counting. The use of counter variable type is helpful in adding a custom logic, counting the loop, numbering the iteration, feeding the counting etc. ‘Counter’ variable type has the following inputs:

  1. Name: To provide the name of the variable (Counter) 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. Starting value: The starting value of the counter variable. Example: 0 or 1 etc. This is a mandatory input.
  4. Maximum value: The maximum value of the counter variable to be generated. This is a mandatory input.
  5. Increment value: The rate by which the value of the variable needs to be incremented. This is a mandatory input.
  6. Value change policy: To define the setting when the value will be changed
    1. On each use (Default value)
    2. On each request
    3. On each page
    4. On each iteration
    5. For each Virtual User instance
  7. Variable values distribution policy: To define the scope and distribution setting of the variable
    1. Scope: The available values are:
      1. Local
      2. Global (Default Value)
      3. Unique
    2. When Out of Values: The available values are:
      1. Cycle values (Default Value)
      2. Stop the test
      3. Return the value “<No Values>”


Consider, a request that checks the status of an order from ‘Entering’ to ‘Pending Payment’ and then finally ‘Order Placed’ state. The request is placed inside a loop and the loop exit when the status becomes ‘Order Placed’. Now the requirement is to count the execution of the loop until it gets exited. So, create a counter variable with the name ‘countLoop’, start value as 1, end value as 1000 and increment by 1. The scope of the loop will be local and the value will be changed on each use. Refer to the below screenshot of how this scenario will be illustrated.

NeoLoad - Counter Variable
Figure 01

You may be interested:

Leave a Reply

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