JMeter functions are special values that can populate fields of any Sampler or another element in a test tree. A function call looks like this:
${__functionName(var1,var2,var3)}
Where “__functionName” matches the name of a function.
Parentheses surround the parameters sent to the function, for example, ${__time(YMD)} The actual parameters vary from function to function. Functions that require no parameters can leave off the parentheses, for example, ${__threadNum}.
The best way to use JMeter function proficiency and correctly is using the Functional Helper dialog, check that post to see the detail.
Below is the list of functions (include plugin functions), click on the function name to view the detail how to use that function.
NOTE: if the function name has no hyperlink, it means the detailed post for that function is still not available, don’t worry, I will write all of them and post here as soon as possible. Or what function do you want to know first, please leave a comment below, I will create the post for that first.
Type of function | Name | Comment | Since |
---|---|---|---|
Info | threadNum | get thread number | 1.X |
Info | threadGroupName | get thread group name | 4.0 |
Info | samplerName | get the sampler name (label) | 2.5 |
Info (Plugin) |
iterationNum | Returns the number of current iteration in the thread group. | Plugin 1.2.1 |
Info | machineIP | get the local machine IP address | 2.6 |
Info | machineName | get the local machine name | 1.X |
Info | time | return current time in various formats | 2.2 |
Info | timeShift | return a date in various formats with the specified amount of seconds, minutes, hours, days added | 3.3 |
Info | log | log (or display) a message (and return the value) | 2.2 |
Info | logn | log (or display) a message (empty return value) | 2.2 |
Input | StringFromFile | read a line from a file | 1.9 |
Input | FileToString | read an entire file | 2.4 |
Input | CSVRead | read from CSV delimited file | 1.9 |
Input | XPath | Use an XPath expression to read from a file | 2.0.3 |
Formatting | dateTimeConvert | Convert a date or time from source to target format | 4.0 |
Calculation | digest | Generate a digest (SHA-1, SHA-256, MD5…) | 4.0 |
Calculation | counter | generate an incrementing number | 1.X |
Calculation | intSum | add int numbers | 1.8.1 |
Calculation | longSum | add long numbers | 2.3.2 |
Calculation (Plugin) |
doubleSum | Compute the sum of two or more floating point values. | Plugin 0.4.2 |
Calculation | Random | generate a random number | 1.9 |
Calculation | RandomDate | generate random date within a specific date range | 3.3 |
Calculation | RandomFromMultipleVars | extracts an element from the values of a set of variables separated by | | 3.1 |
Calculation | RandomString | generate a random string | 2.6 |
Calculation (Plugin) |
chooseRandom | Choose single random value from the list of its arguments | Plugin 1.0.1 |
Calculation(Plugin) | if | This function provides (a == b) ? a : b syntax. |
Plugin 1.3.0 |
Calculation | UUID | generate a random type 4 UUID | 2.9 |
Scripting | groovy | run a Groovy script | 3.1 |
Scripting | BeanShell | run a BeanShell script | 1.X |
Scripting | javaScript | process JavaScript (Nashorn) | 1.9 |
Scripting | jexl2 | evaluate a Commons Jexl2 expression | jexl2(2.1.1) |
Scripting | jexl3 | evaluate a Commons Jexl3 expression | jexl3 (3.0) |
Properties | isPropDefined | Test if a property exists | 4.0 |
Properties | property | read a property | 2.0 |
Properties | P | read a property (shorthand method) | 2.0 |
Properties | setProperty | set a JMeter property | 2.1 |
Variables | split | Split a string into variables | 2.0.2 |
Variables | isVarDefined | Test if a variable exists | 4.0 |
Variables | V | evaluate a variable name | 2.3RC3 |
Variables | eval | evaluate a variable expression | 2.3.1 |
Variables | evalVar | evaluate an expression stored in a variable | 2.3.1 |
Variables (Plugin) |
env | get a value of environment variable | Plugin 1.2.0 |
Variables (Plugin) |
isDefined | Determine if variable was already defined | Plugin 0.4.2 |
String | regexFunction | parse previous response using a regular expression | 1.X |
String | escapeOroRegexpChars | quote meta chars used by ORO regular expression | 2.9 |
String | char | generate Unicode char values from a list of numbers | 2.3.3 |
String | changeCase | Change case following different modes | 4.0 |
String | unescape | Process strings containing Java escapes (e.g. \n & \t) | 2.3.3 |
String | unescapeHtml | Decode HTML-encoded strings | 2.3.3 |
String | escapeHtml | Encode strings using HTML encoding | 2.3.3 |
String | escapeXml | Encode strings using XMl encoding | 3.2 |
String | urldecode | Decode a application/x-www-form-urlencoded string | 2.10 |
String | urlencode | Encode a string to a application/x-www-form-urlencoded string | 2.10 |
String | TestPlanName | Return name of current test plan | 2.6 |
String (Plugin) |
strLen | Compute the length of constant string or variable value. | Plugin 0.4.2 |
String (Plugin) |
substring | This function is wrapper for Java String.substring method | Plugin 0.4.2 |
String (Plugin) |
strReplace | This function is wrapper for Java String.replace method. | Plugin 1.4.0 |
String (Plugin) |
strReplaceRegex | This function is wrapper for Java String.replaceAll method. | Plugin 1.4.0 |
String (Plugin) |
MD5 | Calculate MD5 hash of constant string or variable value | Plugin 0.4.2 |
String (Plugin) |
base64Encode | Encode a constant string or variable value using Base64 algorithm. | Plugin 1.2.0 |
String (Plugin) |
base64Decode | Decode a constant string or variable value from Base64 into string. | Plugin 1.2.0 |
String (Plugin) |
uppercase | Transform the case of the constant string or variable value to uppercase. | Plugin 0.4.2 |
String (Plugin) |
lowercase | Transform the case of the constant string or variable value to lowercase. | Plugin 0.4.2 |