Skip to content

Variables

variables-menu

The variable page lets you configure, variables to use in your virtual users. These variables will be shared across the project, meaning they are available to any virtual user in this project. Because of that you should pay extra care when making changes since they can have an impact on several virtual users.


Variables list

Variables list

The variables page uses a layout with the list on the left and edition on the right. The list features all the usual possibilities as described in the dedicated section about lists.

Usage

usage

A single click inside the usage section will copy a variable name in order for you to use it in your virtual user. This way you do not have to manually input the ${...} syntax.

Info

Variables can be used anywhere in your virtual user except in:

  • Container names
  • Request names

This means you can use variables inside text content like in JSR scripts (although not recommended) or inside raw bodies of requests. Nested variables are possible but this requires the use of a function.

Variables types

  • Constant Variable


    Associate a single constant value to the variable name.

    Reference

  • Random Variable


    Associate a single random value to the variable name.

    Reference

  • Counter Variable


    Increase the count inside this variable on every iteration.

    Reference

  • CSV Variable


    Use a CSV formatted file for the values of the variable.

    Reference

  • Secret Variable


    The value of this variable is not visible anymore after its creation.

    Reference

Predefined variables

JMeterThread.last_sample_ok

This variable contains true or false depending on the status of the last sample executed.

Example

${JMeterThread.last_sample_ok} after a sampler ok, returns true

START.HMS

This variable contains the JMeter start time in UTC time.

Example

${START.HMS} returns 122402 for a test started at 12:24:02.

START.MS

This variable contains the JMeter start timestamp in UTC time.

Example

${START.MS} returns 1631190242724 for a test started at 12:24:02 on the 9th of september 2021.

START.YMD

This variable contains the JMeter start date in UTC time.

Example

${START.YMD} returns 20210909 for a test started on the 9th of september 2021.

TESTSTART.MS

This variable contains the test start timestamp in UTC time. It differs from the JMeter start time since it measure the effective start time of the first thread.

Example

${TESTSTART.MS} returns 1631190243262

__jmeter.U_T__

This variable contains the threadgroup name followed by virtual user number-iteration number.

Example

${__jmeter.U_T__} returns unOEv3sBYy9LOuX37AC2 1-1