Skip to content

Counter Variable Configuration

Counter Variable

The Counter Variable is used to generate numeric counters. It is set to Start value at initialization, incremented by Increment on each new iteration until it reaches End.

Note

A click on the blue variable name in the Usage section will copy it to the clipboard.

The value is shared between all virtual users running on the same load generator by default but you can change this behavior.

Warning

If your test is distributed across several load generators, each one will keep a counter of its own. In case you need a unique value, consider using a large random variable or a CSV variable instead.


For each Counter Variable, you can edit:

Property name Description
Name The variable name. To inject it, use the ${...} syntax.
Description The variable description text.
Start Value The Counter Variable starting value.
End Value The Counter Variable ending value.
Increment Value The Counter Variable increment, applied on each iteration.
Output Format The output format of the generated value. Leave blank for a simple number output. It uses the java.text.DecimalFormat. For example 000 generates numbers with at least 3 digits, and USER_000 generates output of the form USER_nnn.

Behavior

counter-variable-behavior

Name Description
Track counter The Counter Variable can be local to each user if this is activated, making it an iteration counter for each VU. You can also use the ${__iterationNum} function instead of this setting.
Reset counter The Counter Variable will be reset to Start on every iteration. The counter will thus always contain Start. This can be useful as an initialization if you then use it in scripts during each iteration.