Variables¶
The variable page lets you configure, variables for all your virtual users.
To open the variables page, simply click on the Configuration > Variables button in the Virtual User page or use the upper menu:
Variables list¶
The left part of the page lists all the variables for the current project. Variables declared in this list are common to all the VUs of a project. You can use the headers of this list to filter or sort it.
The right part displays the selected variable configuration. It is only editable if a variable is selected.
Four types of variables are available:
- Constant Variables that associate a single value to the variable name,
- Random Variables that associate a single random value to the variable name,
- Counter Variables that increase the count every iteration,
- CSV Variables that uses a CSV formatted file for the values of the variable.
Add Variable¶
The following procedure explains how to add a variable configuration:
- Click on the Add button,
- A dropdown appears,
- Select the type of variable to add: Constant, Random, Counter or CSV,
- A new variable name
variable_n
is added to the list and selected. - Edit the input fields on the right,
- Close the variable panel by clicking on the Close
button positioned at the top right corner.
Remove Variable¶
The following procedure explains how to remove a variable configuration:
- Click on the variable to remove in the variables list,
- Click on the Delete button.
Info
You can use SHIFT + click or CTRL + click to select multiple variables and delete them all at once.
Warning
As variables are commons to all VUs of a project, variable removal and update may affect VUs that you are note currently editing.
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