Variables and Functions

Variables are used to add dynamic content to a scenario. They may be combined with other variables or with static content (e.g. ${product_${productID}}) and used in a number of places, such as in form parameter values.

Create a variable

The Variables dialog is accessible:

  • with the Edit > Variables command

  • with a click on the Variables toolbar button.

To create a variable, click the New Variable button.

Then select the type of variable you want to create:

Starting from line

You can choose at what line to start using your File and List-type variables.

Enter the line number in the Starting from line field.

When "Starting from line" is used with the option "Cycle values", values are starting from the line configured only in the first cycle.

Datasets

File and List-type variables may be populated using predefined datasets.

Datasets are organized by themes and countries: zip codes, family names, country names, street names, female first names, male first names, and street types.

Only one theme may be used for a given variable.

Value change policy

All variables (except CurrentDate) may define a value change policy. This is sometimes referred to as a variable lifetime.

  • Each use: The value is systematically changed upon each use.

  • Each request: The value is changed each time a new HTTP/HTTPS request is played, the variable retaining the same value in both the request and the response to the frame.

  • Each page: The value is changed each time a new page is played, the variable retaining the same value for all the requests defined in the page.

  • Each iteration: The value is changed when switching between Containers Init - Actions - End and for each iteration of the Actions Container, the variable keeping the same value for all the pages and requests within a same iteration.

  • Each Virtual User instance: The variable retains the same value for all pages and requests of a given Virtual User instance.

Value distribution policy

A variable value distribution has three available settings:

  • Scope: The value scope can be:

    • Local: The values are specific to each Virtual User.

    • Global: The values are shared among Virtual Users.

    • Unique: Identical to Global, with the guarantee that a value is only used by a single Virtual User at a time.

  • Order: Values may be distributed in a set order:

    • Sequential: Values are taken in the order they are defined.

    • Random: Values are taken in random order.

    • Any: Best effort sequential order. This order is more efficient than sequential order.

  • When no values are left: Several policies can be applied:

    • Cycle: The values are used over again, starting from the top.

    • Stop test: The load test run is stopped when all the variable values have been used.

    • Return the value "<NO VALUE>": All subsequent requests for values return this value.

Duplicate a variable

In the Variables dialog, a variable can be duplicated to quickly and easily create another variable.

After selecting an existing variable, a click on the Duplicate variable button creates a new instance of the variable with the same configuration. To edit the variable duplicate, see Create a variable.

Remove a variable

In the Variables dialog, a variable can be removed. After selecting a variable, a click on the Remove variable button deletes the variable.

Removing a variable used in a request creates an inconsistency in the scenario.

Test a variable

The variable testing tool may be used to verify a variable syntax and value change policy:

Click on the Apply Action and Evaluate button to simulate and validate the variable value change policy.