Functions which are used on the Test Plan have some restrictions. JMeter thread variables will
have not been fully set up when the functions are processed, so variable names passed as
parameters will not be set up, and variable references will not work, so split() and regex() and
the variable evaluation functions won't work. The threadNum() function won't work (and
does not make sense at test plan level).
Referencing variables and functions
Referencing a variable in a test element is done by bracketing the variable name with '${' and '}'.
Functions are referenced in the same manner, but by convention, the names of functions beg in with "__" to
avoid conflict with user value names.
Some functions take arg uments to config ure them, and these g o in parentheses, comma-delimited. If the
function takes no arg uments, the parentheses can be omitted. For eg :
${__BeanShell(vars.put("name"\,"value"))}
Alternatively, you can define your script as a variable, e.g . on the Test Plan:
SCRIPT vars.put("name","value")
The script can then be referenced as follows:
${__BeanShell(${SCRIPT})}
The Function Helper Dialog
The Function Helper Dialog is available from JMeter's Options tab.
Using the Function Helper, you can select a function from the pull down, and assig n values for its
arg uments. The left column in the table provides a brief description of the arg ument, and the rig ht column
is where you write in the value for that arg ument. Different functions take different arg uments.
Once you have done this, click the “Generate" button, and the appropriate string is g enerated for you to
copy-paste into your test plan wherever you like.
Pre-defined Variables
Some variables are defined internally by JMeter. They are:
COOKIE_cookiename - contains the cookie value
JMeterThread.last_sample_ok - whether or not the last sample was OK - true/false. Note: this is updated
after PostProcessors and Assertions have been run.
START variables
Pre-defined Properties
Some built-in properties are defined by JMeter. These are listed below. For convenience, the START
properties are also copied to variables with the same names.
START.MS - JMeter start time in milliseconds
START.YMD - JMeter start time as yyyyMMdd
START.HMS - JMeter start time as HHmmss
TESTSTART.MS - test start time in milliseconds