Applies to LoadComplete 4.97, last modified on May 20, 2019

Incremental variables allow you to generate a sequence of numbers or dates to use in user scenarios. Each incremental variable has an initial value and an increment step and updates its value at certain times (for example, on each use). Incremental variables are similar to list variables, except for the fact that their values are generated dynamically based on the increment settings rather than taken from a predefined list.

You can use incremental variables to specify query string parameters of GET requests as well as to form values of POST requests:

GET /cart/add/?pid=@ProductID HTTP/1.1

We recommend that you select a variable whose data type matches the parameter data type. If LoadComplete fails to convert the variable value to the parameter data type, the test server may raise an error.

Depending on the increment settings, different virtual users will be able to play back the parameterized request using different parameter values:

GET /cart/add/?pid=1 HTTP/1.1
GET /cart/add/?pid=2 HTTP/1.1
GET /cart/add/?pid=3 HTTP/1.1
and so on

This way, you will get more realistic behavior than that when using the same recorded value for all virtual users.

For more information about using variables in requests, see About Variables.

Tip: If you need to generate random values rather than sequential values from a specific range, use random variables.

Parameters

Incremental variables have the following parameters:

Name

The variable name, which will be used to refer to this variable in request parameters. The name can include only letters (A..Z, a..z), digits (0..9) or underscores ( _ ) and must be unique within the project.

Initial value

The variable’s initial value.
Note: If the variable is set to generate a sequence of dates, Initial value must be specified in the short date format that is defined in the Regional and Language Options on the current computer. For example, if your computer uses the English (United States) format, the June 24, 2008 date should be specified as 6/24/2008.

Step

The value by which the variable value is incremented. It is 1 by default.

If the Value Type is set to Date, Step is the number of days by which the date is incremented.

Value Type

Specifies the data type of the variable’s value:
  • Integer - The variable generates a sequence of integer numbers.

  • Date - The variable generates a sequence of dates.

Note that the value type also determines the format of the generated values. When a virtual user requests the variable value during the load test run, the value is returned in the format defined by the Regional and Language Options on the virtual user’s workstation. For example, the June 24, 2008 date will be formatted as 6/24/2008 on workstations with English (United States) format settings, as 24.06.2008 on workstations with German format settings, as 2008-06-24 on workstations with Polish format settings, and so on.

Increment Type

Specifies at what moments the variable increments its value:

  • Increment value on each use by a virtual user - In this case, each virtual user gets the same sequence of values that starts from the initial value, then follows the second value and so on. The variable changes its value each time a given user accesses it. If the variable is used multiple times within the same request, the value is changed each time.

    Suppose, your test contains an incremental variable with initial value 1 and step 1. The following table illustrates the variable values returned for virtual users on two workstations. The example assumes that virtual users perform the same requests and that the variable is used in all requests. Value sequences associated with individual virtual users are marked with different colors.

      Workstation 1 Workstation 2
    Virtual User 1 Virtual User 2 Virtual User 1 Virtual User 2
    Request 1 1 1 1 1
    Request 2 2 2 2 2
    Request 3 3 3 3 3
  • Increment value on each use - In this scenario, the value is changed on each use, that is, any time any virtual user from any workstation obtains the variable value. If the variable is used multiple times within the same request, the value is changed each time.

    Suppose, your test contains an incremental variable with initial value 1 and step 1. The following table illustrates the variable values returned for virtual users on two workstations. The example assumes that virtual users perform the same requests and that the variable is used in all requests.

    Request Playback Order Variable Value
    Workstation 1 Workstation 2 Workstation 1 Workstation 2
    Request 1 of VU 1   1  
      Request 1 of VU 1   2
      Request 1 of VU 2   3
      Request 2 of VU 1   4
    Request 1 of VU 2   5  
  • Increment value on each use within a station - In this case, each workstation manages its own copy of the variable. The variable value is changed on each use on the given workstation.

    Suppose, your test contains an incremental variable with initial value 1 and step 1. The following table illustrates the variable values returned for virtual users on two workstations. The example assumes that virtual users perform the same requests and that the variable is used in all requests. Value sequences associated with individual workstations are marked with different colors.

    Request Playback Order Variable Value
    Workstation 1 Workstation 2 Workstation 1 Workstation 2
    Request 1 of VU 1   1  
      Request 1 of VU 1   1
      Request 1 of VU 2   2
      Request 2 of VU 1   3
    Request 1 of VU 2   2  
      Request 1 of VU 3   4

See Also

Random Variables
List Variables
Excel Variables
CSV Variables
Database Variables
Constant Variables
Current Date Variables

Highlight search results