Custom JMeter FunctionsIn addition to standard JMeter functions we provide: chooseRandomsince 1.0.1This function choose single random value from the list of its arguments. The last argument is not taken into choice, it is interpreted as variable name to store the result. Parameters: 1. First value to choose from 1. Second value to choose from 1. ... any number of further choices ... 1. Mandatory variable to store result Example, choosing random color and assigning it to randomColor variable:
doubleSumsince 0.4.2This function used to compute the sum of two or more floating point values. Parameters: 1. First value to sum - required 1. Second value to sim - required 1. More values to sum - optional 1. Last argument - variable name to store the result Example, returning 8.3 and also saving it to variable
envsince 1.2.0This function used to get a value of environment variable. Returns value of environment variable if variable was defined, variable name instead (or default value) . Parameters: 1. First value is a name of environment variable - required 1. Second argument - variable name to store the result - optional 1. Third argument - default value if environment variable is not set - optional Example, returning value of ENV_VAR and also saving it to variable someVariable (or defaultValue if ENV_VAR is not set):
isDefinedsince 0.4.2This function used to determine if variable was already defined. Returns 1 if variable was defined, 0 instead. Parameters: 1. First value is string constant, variable, or function call - required Example, getting defined status for variable name 'testVar':
MD5since 0.4.2This function used to calculate MD5 hash of constant string or variable value. Parameters: 1. First value is string constant, variable, or function call - required 1. Second argument - variable name to store the result Example, calculating MD5 for 'test':
base64Encodesince 1.2.0This function used to encode a constant string or variable value using Base64 algorithm. Parameters: 1. First value is string constant, variable, or function call - required 1. Second argument - variable name to store the result Example, encoding 'test string':
base64Decodesince 1.2.0This function used to decode a constant string or variable value from Base64 into string. Parameters: 1. First value is string constant, variable, or function call - required 1. Second argument - variable name to store the result Example, decoding that returns 'test string':
strLensince 0.4.2This function used to compute the length of constant string or variable value. Parameters: 1. First value is string constant, variable, or function call - required 1. Second argument - variable name to store the result Example, returning 11 and also saving it to variable
Example, returning length of variable
substringsince 0.4.2This function is wrapper for Java String.substring method. Parameters: 1. First value is string constant, variable, or function call - required 1. Begin index 1. End index 1. Optional variable to store result Example, getting 'str' from 'test string':
strReplacesince 1.4.0This function is wrapper for Java String.replace method. Parameters: 1. First value is string constant, variable, or function call - required 1. Search substring 1. Replacement 1. Optional variable to store result Example, getting 'banana dog orange' from 'banana apple orange':
strReplaceRegexsince 1.4.0This function is wrapper for Java String.replaceAll method. Parameters: 1. First value is string constant, variable, or function call - required 1. Search regular expression 1. Replacement (can contain references to matched string parts, see Matcher.replaceAll) 1. Optional variable to store result Example, getting
uppercase and lowercasesince 0.4.2This functions used to transform the case of constant string or variable value. Parameters: 1. First value is string constant, variable, or function call - required 1. Second argument - variable name to store the result Example, transforming 'test' into 'TEST' and also saving it to variable
iterationNumsince 1.2.1Function returns the number of current iteration in thread group. Function has no parameters. ifsince 1.3.0This function provides a == b ? a : b syntax. Parameters: 1. Actual value 1. Expected value 1. if condition true value 1. if condition false value 1. Optional variable to store result Example, gettig different values for jmeter variable:
caseFormatsince 2.0This function provides changing string case format. Parameters:
1. Original string value - required
1. Expected case mode (case insenstive), Default is LOWER_CAMEL_CASE (if not valid mode will return string as is) Example, save in myString Variable value "my-string" ${__caseFormat("my String", "LOWER_HYPHEN", myString); Case modes available:
|