Class JmeterFunctions
- java.lang.Object
-
- org.anasoid.jmc.core.wrapper.jmc.functions.JmeterFunctions
-
public final class JmeterFunctions extends java.lang.ObjectImplementation of Native Jmeter functions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJmeterFunctions.ChangeCaseModeMode for change case method.static classJmeterFunctions.DigestAlgorithmAlgorithm for digest method.static classJmeterFunctions.LogLevelLog Level.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringALPHAAlpha characters.static java.lang.StringALPHA_NUMERICAlpha Numeric characters.static java.lang.StringALPHA_UPPERUpper alpha characters.static java.lang.StringNUMERICNumeric characters.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringchangeCase(@NonNull java.lang.String input, JmeterFunctions.ChangeCaseMode mode)The change case function returns a string value which case has been changed following a specific mode.static java.lang.Stringchars(java.lang.String... input)The char function returns the result of evaluating a list of numbers as Unicode characters.static java.lang.Stringcounter(@NonNull java.lang.Boolean perThread)The counter generates a new number each time it is called, starting with 1 and incrementing by +1 each time.static java.lang.Stringcounter(@NonNull java.lang.Boolean perThread, Variable variableName)The counter generates a new number each time it is called, starting with 1 and incrementing by +1 each time.static java.lang.StringcsvRead(@NonNull java.lang.String file, @NonNull java.lang.Integer columnNum)The CSVRead function returns a string from a CSV file (c.f.static java.lang.StringcsvRead(@NonNull java.lang.String file, @NonNull java.lang.String columnNum)The CSVRead function returns a string from a CSV file (c.f.static java.lang.StringdateTimeConvert(@NonNull java.lang.String source, java.lang.String targetDateFormat)The __dateTimeConvert function converts a date that is in source format to a target format storing the result optionally in the variable name.static java.lang.StringdateTimeConvert(@NonNull java.lang.String source, java.lang.String sourceDateFormat, java.lang.String targetDateFormat)The __dateTimeConvert function converts a date that is in source format to a target format storing the result optionally in the variable name.static java.lang.StringdateTimeConvert(@NonNull java.lang.String source, java.lang.String sourceDateFormat, java.lang.String targetDateFormat, Variable variableName)The __dateTimeConvert function converts a date that is in source format to a target format storing the result optionally in the variable name.static java.lang.StringdateTimeConvert(@NonNull java.lang.String source, java.lang.String targetDateFormat, Variable variableName)The __dateTimeConvert function converts a date that is in source format to a target format storing the result optionally in the variable name.static java.lang.Stringdigest(@NonNull java.lang.String input, @NonNull JmeterFunctions.DigestAlgorithm algorithm, java.lang.Boolean upper)The digest function returns an encrypted value in the specific hash algorithm with the optional salt, upper case and variable name.static java.lang.Stringdigest(@NonNull java.lang.String input, @NonNull JmeterFunctions.DigestAlgorithm algorithm, java.lang.String salt)The digest function returns an encrypted value in the specific hash algorithm with the optional salt, upper case and variable name.static java.lang.Stringdigest(@NonNull java.lang.String input, @NonNull JmeterFunctions.DigestAlgorithm algorithm, java.lang.String salt, java.lang.Boolean upper, Variable variable)The digest function returns an encrypted value in the specific hash algorithm with the optional salt, upper case and variable name.static java.lang.Stringdigest(@NonNull java.lang.String input, @NonNull JmeterFunctions.DigestAlgorithm algorithm, java.lang.String salt, Variable variable)The digest function returns an encrypted value in the specific hash algorithm with the optional salt, upper case and variable name.static java.lang.Stringdigest(@NonNull java.lang.String input, @NonNull JmeterFunctions.DigestAlgorithm algorithm, Variable variable)The digest function returns an encrypted value in the specific hash algorithm with the optional salt, upper case and variable name.static java.lang.StringescapeHtml(java.lang.String input)Encode strings using HTML encoding.static java.lang.StringescapeOroRegexpChars(java.lang.String input)quote meta chars used by ORO regular expression .static java.lang.StringescapeOroRegexpChars(java.lang.String input, Variable variableName)quote meta chars used by ORO regular expression .static java.lang.StringescapeXml(java.lang.String input)Encode strings using XMl encoding .static java.lang.Stringeval(@NonNull java.lang.String val)The eval function returns the result of evaluating a string expression.static java.lang.StringevalVar(@NonNull Variable variable)The evalVar function returns the result of evaluating an expression stored in a variable.static java.lang.StringfileToString(@NonNull java.lang.String file, java.lang.String encoding)The FileToString function can be used to read an entire file.static java.lang.StringfileToString(@NonNull java.lang.String file, java.lang.String encoding, Variable variable)The FileToString function can be used to read an entire file.static java.lang.StringfileToString(@NonNull java.lang.String file, Variable variable)The FileToString function can be used to read an entire file.static java.lang.Stringgroovy(@NonNull java.lang.String expression)The groovy function evaluates Apache Groovy scripts passed to it, and returns the result.static java.lang.Stringgroovy(@NonNull java.lang.String expression, Variable variableName)The groovy function evaluates Apache Groovy scripts passed to it, and returns the result.static java.lang.StringintSum(java.lang.Integer... values)The intSum function can be used to compute the sum of two or more integer values.static java.lang.StringintSum(java.lang.String... values)The intSum function can be used to compute the sum of two or more integer values.static java.lang.StringintSum(Variable variable, java.lang.Integer... values)The intSum function can be used to compute the sum of two or more integer values.static java.lang.StringintSum(Variable variable, java.lang.String... values)The intSum function can be used to compute the sum of two or more integer values.static java.lang.StringisPropDefined(@NonNull java.lang.String propertyName)The __isPropDefined function returns true if property exists or false if not.static java.lang.StringisVarDefined(@NonNull Variable variable)The isVarDefined function returns true if variable exists or false if not.static java.lang.StringjavaScript(@NonNull java.lang.String expression)The javaScript function executes a piece of JavaScript (not Java!) code and returns its value.static java.lang.StringjavaScript(@NonNull java.lang.String expression, Variable variableName)The javaScript function executes a piece of JavaScript (not Java!) code and returns its value.static java.lang.Stringjexl3(@NonNull java.lang.String expression)The jexl function returns the result of evaluating a Commons JEXL expression.static java.lang.Stringjexl3(@NonNull java.lang.String expression, Variable variableName)The jexl function returns the result of evaluating a Commons JEXL expression.static java.lang.Stringlog(java.lang.String input)The log function logs a message, and returns its input string.static java.lang.Stringlog(java.lang.String input, JmeterFunctions.LogLevel logLevel)The log function logs a message, and returns its input string.static java.lang.Stringlog(java.lang.String input, JmeterFunctions.LogLevel logLevel, java.lang.String comment)The log function logs a message, and returns its input string.static java.lang.Stringlog(java.lang.String input, JmeterFunctions.LogLevel logLevel, java.lang.String throwable, java.lang.String comment)The log function logs a message, and returns its input string.static java.lang.Stringlogn(java.lang.String input)The logn function logs a message, and returns the empty string.static java.lang.Stringlogn(java.lang.String input, JmeterFunctions.LogLevel logLevel)The logn function logs a message, and returns the empty string.static java.lang.Stringlogn(java.lang.String input, JmeterFunctions.LogLevel logLevel, java.lang.String throwable)The logn function logs a message, and returns the empty string.static java.lang.StringlongSum(java.lang.Long... values)The longSum function can be used to compute the sum of two or more long values, use this instead of __intSum whenever you know your values will not be in the interval -2147483648 to 2147483647.static java.lang.StringlongSum(java.lang.String... values)The longSum function can be used to compute the sum of two or more long values, use this instead of __intSum whenever you know your values will not be in the interval -2147483648 to 2147483647.static java.lang.StringlongSum(Variable variable, java.lang.Long... values)The longSum function can be used to compute the sum of two or more long values, use this instead of __intSum whenever you know your values will not be in the interval -2147483648 to 2147483647.static java.lang.StringlongSum(Variable variable, java.lang.String... values)The longSum function can be used to compute the sum of two or more long values, use this instead of __intSum whenever you know your values will not be in the interval -2147483648 to 2147483647.static java.lang.StringmachineIP()The machineIP function returns the local IP address.static java.lang.StringmachineIP(Variable variable)The machineIP function returns the local IP address.static java.lang.StringmachineName()The machineName function returns the local host name.static java.lang.StringmachineName(Variable variable)The machineName function returns the local host name.static java.lang.Stringproperty(@NonNull java.lang.String propertyName)The property function returns the value of a JMeter property.static java.lang.Stringproperty(@NonNull java.lang.String propertyName, java.lang.String defaultValue)The property function returns the value of a JMeter property.static java.lang.Stringproperty(@NonNull java.lang.String propertyName, Variable variableName, java.lang.String defaultValue)The property function returns the value of a JMeter property.static java.lang.Stringrandom(int min, int max)The random function returns a random number that lies between the given min and max values.static java.lang.Stringrandom(int min, int max, Variable variableName)The random function returns a random number that lies between the given min and max values.static java.lang.Stringrandom(java.lang.String min, java.lang.String max)The random function returns a random number that lies between the given min and max values.static java.lang.Stringrandom(java.lang.String min, java.lang.String max, Variable variableName)The random function returns a random number that lies between the given min and max values.static java.lang.StringrandomAlpha(int length)The randomAlpha function returns a random alpha String of length using characters in chars to use.static java.lang.StringrandomAlpha(int length, Variable variableName)The randomAlpha function returns a random alpha String of length using characters in chars to use.static java.lang.StringrandomAlpha(java.lang.String length, Variable variableName)The randomAlpha function returns a random alpha String of length using characters in chars to use.static java.lang.StringrandomAlphaNumeric(int length)The randomAlpha function returns a random alpha numeric String of length using characters in * chars to use.static java.lang.StringrandomAlphaNumeric(int length, Variable variableName)The randomAlpha function returns a random alpha numeric String of length using characters in * chars to use.static java.lang.StringrandomAlphaNumeric(java.lang.String length, Variable variableName)The randomAlpha function returns a random alpha numeric String of length using characters in chars to use.static java.lang.StringrandomDate(java.lang.String format, java.lang.String startDate, @NonNull java.lang.String endDate)The RandomDate function returns a random date that lies between the given start date and end date values.static java.lang.StringrandomDate(java.lang.String format, java.lang.String startDate, @NonNull java.lang.String endDate, java.lang.String locale)The RandomDate function returns a random date that lies between the given start date and end date values.static java.lang.StringrandomDate(java.lang.String format, java.lang.String startDate, @NonNull java.lang.String endDate, java.lang.String locale, Variable variableName)The RandomDate function returns a random date that lies between the given start date and end date values.static java.lang.StringrandomFromMultipleVars(@NonNull Variable variable, @NonNull Variable... sourceVariables)The RandomFromMultipleVars function returns a random value based on the variable values provided by Source Variables.static java.lang.StringrandomString(int length, java.lang.String chars)The RandomString function returns a random String of length using characters in chars to use.static java.lang.StringrandomString(int length, java.lang.String chars, Variable variableName)The RandomString function returns a random String of length using characters in chars to use.static java.lang.StringrandomString(java.lang.String length, java.lang.String chars)The RandomString function returns a random String of length using characters in chars to use.static java.lang.StringrandomString(java.lang.String length, java.lang.String chars, Variable variableName)The RandomString function returns a random String of length using characters in chars to use.static java.lang.StringregexFunction(@NonNull java.lang.String regex, java.lang.String template, int match)parse previous response using a regular expression.static java.lang.StringregexFunction(@NonNull java.lang.String regex, java.lang.String template, java.lang.String match)parse previous response using a regular expression.static java.lang.StringsamplerName()The samplerName function returns the name (i.e.static java.lang.StringsamplerName(Variable variable)The samplerName function returns the name (i.e.static java.lang.StringsetProperty(@NonNull java.lang.String propertyName, java.lang.String propertyValue)The setProperty function sets the value of a JMeter property.static java.lang.StringsetProperty(@NonNull java.lang.String propertyName, java.lang.String propertyValue, java.lang.Boolean returnOrigin)The setProperty function sets the value of a JMeter property.static java.lang.Stringsplit(@NonNull java.lang.String input, @NonNull java.lang.String variableName)The setProperty function sets the value of a JMeter property.static java.lang.Stringsplit(@NonNull java.lang.String input, @NonNull java.lang.String variableName, java.lang.String separator)The setProperty function sets the value of a JMeter property.static java.lang.StringstringFromFile(@NonNull java.lang.String file)The StringFromFile function can be used to read strings from a text file.static java.lang.StringstringFromFile(@NonNull java.lang.String file, Variable variable)The StringFromFile function can be used to read strings from a text file.static java.lang.StringstringFromFile(@NonNull java.lang.String file, Variable variable, java.lang.Integer startSequence, java.lang.Integer endSequence)The StringFromFile function can be used to read strings from a text file.static java.lang.StringstringFromFile(@NonNull java.lang.String file, Variable variable, java.lang.String startSequence, java.lang.String endSequence)The StringFromFile function can be used to read strings from a text file.static java.lang.StringstringToFile(@NonNull java.lang.String file, @NonNull java.lang.String input)The __StringToFile function can be used to write a string to a file.static java.lang.StringstringToFile(@NonNull java.lang.String file, @NonNull java.lang.String input, java.lang.Boolean append)The __StringToFile function can be used to write a string to a file.static java.lang.StringstringToFile(@NonNull java.lang.String file, @NonNull java.lang.String input, java.lang.Boolean append, java.lang.String encoding)The __StringToFile function can be used to write a string to a file.static java.lang.StringtestPlanName()The TestPlanName function returns the name of the current test plan (can be used in Including Plans to know the name of the calling test plan).static java.lang.StringthreadGroupName()The thread group name function simply returns the name of the thread group being executed.static java.lang.StringthreadNum()get thread number.static java.lang.Stringtime()The time function returns the current time in various formats.static java.lang.Stringtime(java.lang.String format)The time function returns the current time in various formats.static java.lang.Stringtime(java.lang.String format, Variable variableName)The time function returns the current time in various formats.static java.lang.StringtimeShift(java.lang.String format, java.lang.String dateToShift, java.lang.String valueToShift, java.lang.String locale)The timeShift function returns a date in the given format with the specified amount of seconds, minutes, hours, days or months added.static java.lang.StringtimeShift(java.lang.String format, java.lang.String dateToShift, java.lang.String valueToShift, java.lang.String locale, Variable variableName)The timeShift function returns a date in the given format with the specified amount of seconds, minutes, hours, days or months added.static java.lang.Stringunescape(java.lang.String input)Process strings containing Java escapes (e.g.static java.lang.StringunescapeHtml(java.lang.String input)Decode HTML-encoded strings.static java.lang.StringurlDecode(java.lang.String url)Decode a application/x-www-form-urlencoded string.static java.lang.StringurlEncode(java.lang.String url)Encode a string to a application/x-www-form-urlencoded string.static java.lang.Stringuuid()The UUID function returns a pseudo random type 4 Universally Unique IDentifier (UUID)..static java.lang.StringvariableValue(java.lang.String varName)The V (variable) function returns the result of evaluating a variable name expression.static java.lang.StringvariableValue(java.lang.String varName, java.lang.String defaultValue)The V (variable) function returns the result of evaluating a variable name expression.static java.lang.Stringxpath(@NonNull java.lang.String file, @NonNull java.lang.String xpath)The XPath function reads an XML file and matches the XPath.
-
-
-
Field Detail
-
ALPHA
public static final java.lang.String ALPHA
Alpha characters.- See Also:
- Constant Field Values
-
ALPHA_UPPER
public static final java.lang.String ALPHA_UPPER
Upper alpha characters.
-
NUMERIC
public static final java.lang.String NUMERIC
Numeric characters.- See Also:
- Constant Field Values
-
ALPHA_NUMERIC
public static final java.lang.String ALPHA_NUMERIC
Alpha Numeric characters.- See Also:
- Constant Field Values
-
-
Method Detail
-
changeCase
public static java.lang.String changeCase(@NonNull @NonNull java.lang.String input, JmeterFunctions.ChangeCaseMode mode)The change case function returns a string value which case has been changed following a specific mode. Result can optionally be saved in a JMeter variable.- Parameters:
input- The String which case will be changed.mode- The mode to be used to change case: for example for ab-CD eF: UPPER result as AB-CD EF, LOWER result as ab-cd ed ,CAPITALIZE result as Ab-CD eF s.
-
csvRead
public static java.lang.String csvRead(@NonNull @NonNull java.lang.String file, @NonNull @NonNull java.lang.String columnNum)The CSVRead function returns a string from a CSV file (c.f. StringFromFile)NOTE: JMeter supports multiple file names.
In most cases, the newer CSV Data Set Config element is easier to use.
When a filename is first encountered, the file is opened and read into an internal array. If a blank line is detected, this is treated as end of file - this allows trailing comments to be used.
All subsequent references to the same file name use the same internal array. N.B. the filename case is significant to the function, even if the OS doesn't care, so CSVRead(abc.txt,0) and CSVRead(aBc.txt,0) would refer to different internal arrays.
The *ALIAS feature allows the same file to be opened more than once, and also allows for shorter file names.
Each thread has its own internal pointer to its current row in the file array. When a thread first refers to the file it will be allocated the next free row in the array, so each thread will access a different row from all other threads. [Unless there are more threads than there are rows in the array.]
- Parameters:
file- The file (or *ALIAS) to read from.columnNum- he column number in the file. 0 = first column, 1 = second etc. "next" - go to next line of file. *ALIAS - open a file and assign it to the alias .
-
csvRead
public static java.lang.String csvRead(@NonNull @NonNull java.lang.String file, @NonNull @NonNull java.lang.Integer columnNum)The CSVRead function returns a string from a CSV file (c.f. StringFromFile)NOTE: JMeter supports multiple file names.
In most cases, the newer CSV Data Set Config element is easier to use.
When a filename is first encountered, the file is opened and read into an internal array. If a blank line is detected, this is treated as end of file - this allows trailing comments to be used.
All subsequent references to the same file name use the same internal array. N.B. the filename case is significant to the function, even if the OS doesn't care, so CSVRead(abc.txt,0) and CSVRead(aBc.txt,0) would refer to different internal arrays.
The *ALIAS feature allows the same file to be opened more than once, and also allows for shorter file names.
Each thread has its own internal pointer to its current row in the file array. When a thread first refers to the file it will be allocated the next free row in the array, so each thread will access a different row from all other threads. [Unless there are more threads than there are rows in the array.]
- Parameters:
file- The file (or *ALIAS) to read from.columnNum- he column number in the file. 0 = first column, 1 = second etc. "next" - go to next line of file. *ALIAS - open a file and assign it to the alias .
-
digest
public static java.lang.String digest(@NonNull @NonNull java.lang.String input, @NonNull @NonNull JmeterFunctions.DigestAlgorithm algorithm, java.lang.String salt, java.lang.Boolean upper, Variable variable)The digest function returns an encrypted value in the specific hash algorithm with the optional salt, upper case and variable name.- Parameters:
input- The String that will be encryptedalgorithm- The algorithm to be used to encrypt.salt- Salt to be added to string (after it).upper- Result will be in lower case by default. Choose true to upper case results.variable- A reference name for reusing the value computed by this function.
-
digest
public static java.lang.String digest(@NonNull @NonNull java.lang.String input, @NonNull @NonNull JmeterFunctions.DigestAlgorithm algorithm, java.lang.String salt)The digest function returns an encrypted value in the specific hash algorithm with the optional salt, upper case and variable name.- Parameters:
input- The String that will be encryptedalgorithm- The algorithm to be used to encrypt.salt- Salt to be added to string (after it).
-
digest
public static java.lang.String digest(@NonNull @NonNull java.lang.String input, @NonNull @NonNull JmeterFunctions.DigestAlgorithm algorithm, java.lang.Boolean upper)The digest function returns an encrypted value in the specific hash algorithm with the optional salt, upper case and variable name.- Parameters:
input- The String that will be encryptedalgorithm- The algorithm to be used to encrypt.upper- Result will be in lower case by default. Choose true to upper case results.
-
digest
public static java.lang.String digest(@NonNull @NonNull java.lang.String input, @NonNull @NonNull JmeterFunctions.DigestAlgorithm algorithm, Variable variable)The digest function returns an encrypted value in the specific hash algorithm with the optional salt, upper case and variable name.- Parameters:
input- The String that will be encryptedalgorithm- The algorithm to be used to encrypt.variable- A reference name for reusing the value computed by this function.
-
digest
public static java.lang.String digest(@NonNull @NonNull java.lang.String input, @NonNull @NonNull JmeterFunctions.DigestAlgorithm algorithm, java.lang.String salt, Variable variable)The digest function returns an encrypted value in the specific hash algorithm with the optional salt, upper case and variable name.- Parameters:
input- The String that will be encryptedalgorithm- The algorithm to be used to encrypt. * @param salt Salt to be added to string (after it).variable- A reference name for reusing the value computed by this function.
-
dateTimeConvert
public static java.lang.String dateTimeConvert(@NonNull @NonNull java.lang.String source, java.lang.String sourceDateFormat, java.lang.String targetDateFormat, Variable variableName)The __dateTimeConvert function converts a date that is in source format to a target format storing the result optionally in the variable name.- Parameters:
source- The date string to convert from Source Date Format to Target Date Format. A date as a epoch time could be use here if Source Date Format is empty.sourceDateFormat- The original date format. If empty, the Date String field must be a epoch time.targetDateFormat- The new date format.variableName- A reference name for reusing the value computed by this function.
-
dateTimeConvert
public static java.lang.String dateTimeConvert(@NonNull @NonNull java.lang.String source, java.lang.String sourceDateFormat, java.lang.String targetDateFormat)The __dateTimeConvert function converts a date that is in source format to a target format storing the result optionally in the variable name.- Parameters:
source- The date string to convert from Source Date Format to Target Date Format. A date as a epoch time could be use here if Source Date Format is empty.sourceDateFormat- The original date format. If empty, the Date String field must be a epoch time.targetDateFormat- The new date format.
-
dateTimeConvert
public static java.lang.String dateTimeConvert(@NonNull @NonNull java.lang.String source, java.lang.String targetDateFormat)The __dateTimeConvert function converts a date that is in source format to a target format storing the result optionally in the variable name. the Date String field must be a epoch time.- Parameters:
source- The date string to convert from Source Date Format to Target Date Format. A date as a epoch time could be use here if Source Date Format is empty.targetDateFormat- The new date format.
-
dateTimeConvert
public static java.lang.String dateTimeConvert(@NonNull @NonNull java.lang.String source, java.lang.String targetDateFormat, Variable variableName)The __dateTimeConvert function converts a date that is in source format to a target format storing the result optionally in the variable name. the Date String field must be a epoch time.- Parameters:
source- The date string to convert from Source Date Format to Target Date Format. A date as a epoch time could be use here if Source Date Format is empty.targetDateFormat- The new date format.variableName- A reference name for reusing the value computed by this function.
-
counter
public static java.lang.String counter(@NonNull @NonNull java.lang.Boolean perThread, Variable variableName)The counter generates a new number each time it is called, starting with 1 and incrementing by +1 each time. The counter can be configured to keep each simulated user's values separate, or to use the same counter for all users. If each user's values is incremented separately, that is like counting the number of iterations through the test plan. A global counter is like counting how many times that request was run.- Parameters:
perThread- TRUE if you wish each simulated user's counter to be kept independent and separate from the other users. FALSE for a global counter.variableName- A reference name for reusing the value computed by this function.
-
counter
public static java.lang.String counter(@NonNull @NonNull java.lang.Boolean perThread)The counter generates a new number each time it is called, starting with 1 and incrementing by +1 each time. The counter can be configured to keep each simulated user's values separate, or to use the same counter for all users. If each user's values is incremented separately, that is like counting the number of iterations through the test plan. A global counter is like counting how many times that request was run.- Parameters:
perThread- TRUE if you wish each simulated user's counter to be kept independent and separate from the other users. FALSE for a global counter.
-
chars
public static java.lang.String chars(java.lang.String... input)
The char function returns the result of evaluating a list of numbers as Unicode characters. See also __unescape(), below.- Parameters:
input- The decimal number (or hex number, if prefixed by 0x, or octal, if prefixed by 0) to be converted to a Unicode character..
-
escapeHtml
public static java.lang.String escapeHtml(java.lang.String input)
Encode strings using HTML encoding.- Parameters:
input- String to escape.
-
escapeOroRegexpChars
public static java.lang.String escapeOroRegexpChars(java.lang.String input)
quote meta chars used by ORO regular expression .- Parameters:
input- String to escape.
-
escapeOroRegexpChars
public static java.lang.String escapeOroRegexpChars(java.lang.String input, Variable variableName)quote meta chars used by ORO regular expression .- Parameters:
input- String to escape.variableName- A reference name for reusing the value computed by this function.
-
escapeXml
public static java.lang.String escapeXml(java.lang.String input)
Encode strings using XMl encoding .- Parameters:
input- String to escape.
-
eval
public static java.lang.String eval(@NonNull @NonNull java.lang.String val)The eval function returns the result of evaluating a string expression.- Parameters:
val- expression to be evaluated.
-
evalVar
public static java.lang.String evalVar(@NonNull @NonNull Variable variable)The evalVar function returns the result of evaluating an expression stored in a variable.- Parameters:
variable- expression to be evaluated.
-
fileToString
public static java.lang.String fileToString(@NonNull @NonNull java.lang.String file, java.lang.String encoding, Variable variable)The FileToString function can be used to read an entire file. Each time it is called it reads the entire file. If an error occurs opening or reading the file, then the function returns the string "**ERR**"- Parameters:
file- Path to the file name. (The path can be relative to the JMeter launch directory)encoding- The encoding to be used to read the file. If not specified, the platform default is used.variable- A reference name for reusing the value computed by this function.
-
fileToString
public static java.lang.String fileToString(@NonNull @NonNull java.lang.String file, java.lang.String encoding)The FileToString function can be used to read an entire file. Each time it is called it reads the entire file. If an error occurs opening or reading the file, then the function returns the string "**ERR**"- Parameters:
file- Path to the file name. (The path can be relative to the JMeter launch directory)encoding- The encoding to be used to read the file. If not specified, the platform default is used.
-
fileToString
public static java.lang.String fileToString(@NonNull @NonNull java.lang.String file, Variable variable)The FileToString function can be used to read an entire file. Each time it is called it reads the entire file. If an error occurs opening or reading the file, then the function returns the string "**ERR**"- Parameters:
file- Path to the file name. (The path can be relative to the JMeter launch directory)variable- A reference name for reusing the value computed by this function.
-
groovy
public static java.lang.String groovy(@NonNull @NonNull java.lang.String expression, Variable variableName)The groovy function evaluates Apache Groovy scripts passed to it, and returns the result. Don't escape commas.- Parameters:
expression- An Apache Groovy script.variableName- A reference name for reusing the value computed by this function.
-
groovy
public static java.lang.String groovy(@NonNull @NonNull java.lang.String expression)The groovy function evaluates Apache Groovy scripts passed to it, and returns the result. Don't escape commas.- Parameters:
expression- An Apache Groovy script.
-
intSum
public static java.lang.String intSum(Variable variable, java.lang.String... values)
The intSum function can be used to compute the sum of two or more integer values.- Parameters:
values- value to be logged.variable- A reference name for reusing the value computed by this function.- Returns:
- sum.
-
intSum
public static java.lang.String intSum(java.lang.String... values)
The intSum function can be used to compute the sum of two or more integer values.- Parameters:
values- value to be logged.- Returns:
- sum.
-
intSum
public static java.lang.String intSum(Variable variable, java.lang.Integer... values)
The intSum function can be used to compute the sum of two or more integer values.- Parameters:
values- value to be logged.variable- A reference name for reusing the value computed by this function.- Returns:
- sum.
-
intSum
public static java.lang.String intSum(java.lang.Integer... values)
The intSum function can be used to compute the sum of two or more integer values.- Parameters:
values- value to be logged.- Returns:
- sum.
-
isPropDefined
public static java.lang.String isPropDefined(@NonNull @NonNull java.lang.String propertyName)The __isPropDefined function returns true if property exists or false if not.- Parameters:
propertyName- The Property Name to be used to check if defined.
-
isVarDefined
public static java.lang.String isVarDefined(@NonNull @NonNull Variable variable)The isVarDefined function returns true if variable exists or false if not.- Parameters:
variable- The Variable to be used to check if defined
-
javaScript
public static java.lang.String javaScript(@NonNull @NonNull java.lang.String expression, Variable variableName)The javaScript function executes a piece of JavaScript (not Java!) code and returns its value.- Parameters:
expression- The expression to be evaluated.variableName- A reference name for reusing the value computed by this function.
-
javaScript
public static java.lang.String javaScript(@NonNull @NonNull java.lang.String expression)The javaScript function executes a piece of JavaScript (not Java!) code and returns its value.- Parameters:
expression- The expression to be evaluated.
-
jexl3
public static java.lang.String jexl3(@NonNull @NonNull java.lang.String expression, Variable variableName)The jexl function returns the result of evaluating a Commons JEXL expression. See links below for more information on JEXL expressions.- Parameters:
expression- The expression to be evaluated.variableName- A reference name for reusing the value computed by this function.
-
jexl3
public static java.lang.String jexl3(@NonNull @NonNull java.lang.String expression)The jexl function returns the result of evaluating a Commons JEXL expression. See links below * for more information on JEXL expressions.- Parameters:
expression- The expression to be evaluated.
-
log
public static java.lang.String log(java.lang.String input, JmeterFunctions.LogLevel logLevel, java.lang.String throwable, java.lang.String comment)The log function logs a message, and returns its input string.- Parameters:
input- String to be logged.logLevel- OUT, ERR, DEBUG, INFO (default), WARN or ERROR.throwable- If non-empty, creates a Throwable to pass to the logger.comment- If present, it is displayed in the string. Useful for identifying what is being logged.- Returns:
- logged text.
-
log
public static java.lang.String log(java.lang.String input, JmeterFunctions.LogLevel logLevel, java.lang.String comment)The log function logs a message, and returns its input string.- Parameters:
input- String to be logged.logLevel- OUT, ERR, DEBUG, INFO (default), WARN or ERROR.comment- If present, it is displayed in the string. Useful for identifying what is being logged.
-
log
public static java.lang.String log(java.lang.String input, JmeterFunctions.LogLevel logLevel)The log function logs a message, and returns its input string.- Parameters:
input- String to be logged.logLevel- OUT, ERR, DEBUG, INFO (default), WARN or ERROR.
-
log
public static java.lang.String log(java.lang.String input)
The log function logs a message, and returns its input string.- Parameters:
input- String to be logged.
-
logn
public static java.lang.String logn(java.lang.String input, JmeterFunctions.LogLevel logLevel, java.lang.String throwable)The logn function logs a message, and returns the empty string.- Parameters:
input- String to be logged.logLevel- OUT, ERR, DEBUG, INFO (default), WARN or ERROR.throwable- If non-empty, creates a Throwable to pass to the logger.- Returns:
- logged text.
-
logn
public static java.lang.String logn(java.lang.String input, JmeterFunctions.LogLevel logLevel)The logn function logs a message, and returns the empty string.- Parameters:
input- String to be logged.logLevel- OUT, ERR, DEBUG, INFO (default), WARN or ERROR.- Returns:
- logged text.
-
logn
public static java.lang.String logn(java.lang.String input)
The logn function logs a message, and returns the empty string.- Parameters:
input- String to be logged.- Returns:
- logged text.
-
longSum
public static java.lang.String longSum(Variable variable, java.lang.String... values)
The longSum function can be used to compute the sum of two or more long values, use this instead of __intSum whenever you know your values will not be in the interval -2147483648 to 2147483647.- Parameters:
values- value to be logged.variable- A reference name for reusing the value computed by this function.- Returns:
- sum.
-
longSum
public static java.lang.String longSum(java.lang.String... values)
The longSum function can be used to compute the sum of two or more long values, use this instead of __intSum whenever you know your values will not be in the interval -2147483648 to 2147483647.- Parameters:
values- value to be logged.- Returns:
- sum.
-
longSum
public static java.lang.String longSum(Variable variable, java.lang.Long... values)
The longSum function can be used to compute the sum of two or more long values, use this instead of __intSum whenever you know your values will not be in the interval -2147483648 to 2147483647.- Parameters:
values- value to be logged.variable- A reference name for reusing the value computed by this function.- Returns:
- sum.
-
longSum
public static java.lang.String longSum(java.lang.Long... values)
The longSum function can be used to compute the sum of two or more long values, use this instead of __intSum whenever you know your values will not be in the interval -2147483648 to 2147483647.- Parameters:
values- value to be logged.- Returns:
- sum.
-
machineIP
public static java.lang.String machineIP()
The machineIP function returns the local IP address. This uses the Java method InetAddress.getLocalHost() and passes it to getHostAddress().
-
machineIP
public static java.lang.String machineIP(Variable variable)
The machineIP function returns the local IP address. This uses the Java method InetAddress.getLocalHost() and passes it to getHostAddress().- Parameters:
variable- A reference name for reusing the value computed by this function.
-
machineName
public static java.lang.String machineName()
The machineName function returns the local host name. This uses the Java method InetAddress.getLocalHost() and passes it to getHostName().
-
machineName
public static java.lang.String machineName(Variable variable)
The machineName function returns the local host name. This uses the Java method InetAddress.getLocalHost() and passes it to getHostName().- Parameters:
variable- A reference name for reusing the value computed by this function.
-
property
public static java.lang.String property(@NonNull @NonNull java.lang.String propertyName, Variable variableName, java.lang.String defaultValue)The property function returns the value of a JMeter property. If the property value cannot be found, and no default has been supplied, it returns the property name.- Parameters:
propertyName- he property name to be retrieved.variableName- A reference name for reusing the value computed by this function.defaultValue- The default value for the property.
-
property
public static java.lang.String property(@NonNull @NonNull java.lang.String propertyName, java.lang.String defaultValue)The property function returns the value of a JMeter property. If the property value cannot be found, and no default has been supplied, it returns the property name.- Parameters:
propertyName- he property name to be retrieved.defaultValue- The default value for the property.
-
property
public static java.lang.String property(@NonNull @NonNull java.lang.String propertyName)The property function returns the value of a JMeter property. If the property value cannot be found, and no default has been supplied, it returns the property name.- Parameters:
propertyName- he property name to be retrieved.
-
random
public static java.lang.String random(java.lang.String min, java.lang.String max, Variable variableName)The random function returns a random number that lies between the given min and max values.- Parameters:
min- Minimum value.max- Maximum value.variableName- variableName A reference name for reusing the value computed by this function.
-
random
public static java.lang.String random(java.lang.String min, java.lang.String max)The random function returns a random number that lies between the given min and max values.- Parameters:
min- Minimum value.max- Maximum value.
-
random
public static java.lang.String random(int min, int max, Variable variableName)The random function returns a random number that lies between the given min and max values.- Parameters:
min- Minimum value.max- Maximum value.variableName- variableName A reference name for reusing the value computed by this function.
-
random
public static java.lang.String random(int min, int max)The random function returns a random number that lies between the given min and max values.- Parameters:
min- Minimum value.max- Maximum value.
-
randomAlpha
public static java.lang.String randomAlpha(java.lang.String length, Variable variableName)The randomAlpha function returns a random alpha String of length using characters in chars to use.- Parameters:
length- A number length of generated String.variableName- A reference name for reusing the value computed by this function.
-
randomAlpha
public static java.lang.String randomAlpha(int length, Variable variableName)The randomAlpha function returns a random alpha String of length using characters in chars to use.- Parameters:
length- A number length of generated String.variableName- A reference name for reusing the value computed by this function.
-
randomAlpha
public static java.lang.String randomAlpha(int length)
The randomAlpha function returns a random alpha String of length using characters in chars to use.- Parameters:
length- A number length of generated String.
-
randomAlphaNumeric
public static java.lang.String randomAlphaNumeric(java.lang.String length, Variable variableName)The randomAlpha function returns a random alpha numeric String of length using characters in chars to use.- Parameters:
length- A number length of generated String.variableName- A reference name for reusing the value computed by this function.
-
randomAlphaNumeric
public static java.lang.String randomAlphaNumeric(int length, Variable variableName)The randomAlpha function returns a random alpha numeric String of length using characters in * chars to use.- Parameters:
length- A number length of generated String.variableName- A reference name for reusing the value computed by this function.
-
randomAlphaNumeric
public static java.lang.String randomAlphaNumeric(int length)
The randomAlpha function returns a random alpha numeric String of length using characters in * chars to use.- Parameters:
length- A number length of generated String.
-
randomDate
public static java.lang.String randomDate(java.lang.String format, java.lang.String startDate, @NonNull @NonNull java.lang.String endDate, java.lang.String locale, Variable variableName)The RandomDate function returns a random date that lies between the given start date and end date values.- Parameters:
format- Format string for DateTimeFormatter (default yyyy-MM-dd).startDate- The start date, the default is now.endDate- The end date.locale- The string format of a locale. The language code must be lowercase. The country code must be uppercase. The separator must be an underscore, e.g. en_EN. See http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html. If omitted, by default the function uses the Apache JMeter locale one.variableName- The variable to set.
-
randomDate
public static java.lang.String randomDate(java.lang.String format, java.lang.String startDate, @NonNull @NonNull java.lang.String endDate, java.lang.String locale)The RandomDate function returns a random date that lies between the given start date and end date values.- Parameters:
format- Format string for DateTimeFormatter (default yyyy-MM-dd).startDate- The start date, the default is now.endDate- The end date.locale- The string format of a locale. The language code must be lowercase. The country code must be uppercase. The separator must be an underscore, e.g. en_EN. See http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html. If omitted, by default the function uses the Apache JMeter locale one.
-
randomDate
public static java.lang.String randomDate(java.lang.String format, java.lang.String startDate, @NonNull @NonNull java.lang.String endDate)The RandomDate function returns a random date that lies between the given start date and end date values.- Parameters:
format- Format string for DateTimeFormatter (default yyyy-MM-dd).startDate- The start date, the default is now.endDate- The end date.
-
randomFromMultipleVars
public static java.lang.String randomFromMultipleVars(@NonNull @NonNull Variable variable, @NonNull @NonNull Variable... sourceVariables)The RandomFromMultipleVars function returns a random value based on the variable values provided by Source Variables.- Parameters:
variable- A reference name for reusing the value computed by this function.sourceVariables- Source Variables.
-
randomString
public static java.lang.String randomString(java.lang.String length, java.lang.String chars, Variable variableName)The RandomString function returns a random String of length using characters in chars to use.- Parameters:
length- A number length of generated String.chars- Chars used to generate String.variableName- A reference name for reusing the value computed by this function.
-
randomString
public static java.lang.String randomString(java.lang.String length, java.lang.String chars)The RandomString function returns a random String of length using characters in chars to use.- Parameters:
length- A number length of generated String.chars- Chars used to generate String.
-
randomString
public static java.lang.String randomString(int length, java.lang.String chars, Variable variableName)The RandomString function returns a random String of length using characters in chars to use.- Parameters:
length- A number length of generated String.chars- Chars used to generate String.variableName- A reference name for reusing the value computed by this function.
-
randomString
public static java.lang.String randomString(int length, java.lang.String chars)The RandomString function returns a random String of length using characters in chars to use.- Parameters:
length- A number length of generated String.chars- Chars used to generate String.
-
regexFunction
public static java.lang.String regexFunction(@NonNull @NonNull java.lang.String regex, java.lang.String template, java.lang.String match)parse previous response using a regular expression.- Parameters:
regex- Regular expression used to search previous sample - or variable..template- Template for the replacement string, using groups from the regular expression. Format is $[group]$. Example $1$.match- Which match to use. An integer 1 or greater, RAND to indicate JMeter should randomly choose, A float, or ALL indicating all matches should be used ([1]).
-
regexFunction
public static java.lang.String regexFunction(@NonNull @NonNull java.lang.String regex, java.lang.String template, int match)parse previous response using a regular expression.- Parameters:
regex- Regular expression used to search previous sample - or variable..template- Template for the replacement string, using groups from the regular expression. Format is $[group]$. Example $1$.match- Which match to use. An integer 1 or greater, RAND to indicate JMeter should randomly choose, A float, or ALL indicating all matches should be used ([1]).
-
samplerName
public static java.lang.String samplerName()
The samplerName function returns the name (i.e. label) of the current sampler.
-
samplerName
public static java.lang.String samplerName(Variable variable)
The samplerName function returns the name (i.e. label) of the current sampler.- Parameters:
variable- A reference name for reusing the value computed by this function.
-
setProperty
public static java.lang.String setProperty(@NonNull @NonNull java.lang.String propertyName, java.lang.String propertyValue, java.lang.Boolean returnOrigin)The setProperty function sets the value of a JMeter property. The default return value from the function is the empty string, so the function call can be used anywhere functions are valid.- Parameters:
propertyName- The property name to be set.propertyValue- The value for the property.returnOrigin- Should the original value be returned?
-
setProperty
public static java.lang.String setProperty(@NonNull @NonNull java.lang.String propertyName, java.lang.String propertyValue)The setProperty function sets the value of a JMeter property. The default return value from the function is the empty string, so the function call can be used anywhere functions are valid.- Parameters:
propertyName- The property name to be set.propertyValue- The value for the property.
-
split
public static java.lang.String split(@NonNull @NonNull java.lang.String input, @NonNull @NonNull java.lang.String variableName, java.lang.String separator)The setProperty function sets the value of a JMeter property. The default return value from the function is the empty string, so the function call can be used anywhere functions are valid.- Parameters:
input- String to split, A delimited string, e.g. "a|b|c".variableName- A reference name for reusing the value computed by this function.separator- The delimiter character, e.g. |. If omitted, , is used. Note that , would need to be specified as \,.
-
split
public static java.lang.String split(@NonNull @NonNull java.lang.String input, @NonNull @NonNull java.lang.String variableName)The setProperty function sets the value of a JMeter property. The default return value from the function is the empty string, so the function call can be used anywhere functions are valid.- Parameters:
input- String to split, A delimited string, e.g. "a|b|c".variableName- A reference name for reusing the value computed by this function.
-
stringFromFile
public static java.lang.String stringFromFile(@NonNull @NonNull java.lang.String file, Variable variable, java.lang.String startSequence, java.lang.String endSequence)The StringFromFile function can be used to read strings from a text file. This is useful for running tests that require lots of variable data. For example when testing a banking application, 100s or 1000s of different account numbers might be required.- Parameters:
file- Path to the file name. (The path can be relative to the JMeter launch directory) If using * optional sequence numbers, the path name should be suitable for passing to DecimalFormat.variable- A reference name for reusing the value computed by this function.startSequence- Initial Sequence number (if omitted, the End sequence number is treated as a loop count).endSequence- Final sequence number (if omitted, sequence numbers can increase without limit).
-
stringFromFile
public static java.lang.String stringFromFile(@NonNull @NonNull java.lang.String file, Variable variable, java.lang.Integer startSequence, java.lang.Integer endSequence)The StringFromFile function can be used to read strings from a text file. This is useful for running tests that require lots of variable data. For example when testing a banking application, 100s or 1000s of different account numbers might be required.- Parameters:
file- Path to the file name. (The path can be relative to the JMeter launch directory) If using * optional sequence numbers, the path name should be suitable for passing to DecimalFormat.variable- A reference name for reusing the value computed by this function.startSequence- Initial Sequence number (if omitted, the End sequence number is treated as a loop count).endSequence- Final sequence number (if omitted, sequence numbers can increase without limit).
-
stringFromFile
public static java.lang.String stringFromFile(@NonNull @NonNull java.lang.String file, Variable variable)The StringFromFile function can be used to read strings from a text file. This is useful for running tests that require lots of variable data. For example when testing a banking application, 100s or 1000s of different account numbers might be required.- Parameters:
file- Path to the file name. (The path can be relative to the JMeter launch directory) If using * optional sequence numbers, the path name should be suitable for passing to DecimalFormat.variable- A reference name for reusing the value computed by this function.s
-
stringFromFile
public static java.lang.String stringFromFile(@NonNull @NonNull java.lang.String file)The StringFromFile function can be used to read strings from a text file. This is useful for running tests that require lots of variable data. For example when testing a banking application, 100s or 1000s of different account numbers might be required.- Parameters:
file- Path to the file name. (The path can be relative to the JMeter launch directory) If using * optional sequence numbers, the path name should be suitable for passing to DecimalFormat.
-
stringToFile
public static java.lang.String stringToFile(@NonNull @NonNull java.lang.String file, @NonNull @NonNull java.lang.String input, java.lang.Boolean append, java.lang.String encoding)The __StringToFile function can be used to write a string to a file. Each time it is called it writes a string to file appending or overwriting.- Parameters:
file- Path to file.input- The string to write to the file. If you need to insert a line break in your content, use \n in your string.append- The way to write the string, true means append, false means overwrite. If not specified, the default append is true.encoding- The encoding to be used to write to the file. If not specified, the default encoding is UTF-8.
-
stringToFile
public static java.lang.String stringToFile(@NonNull @NonNull java.lang.String file, @NonNull @NonNull java.lang.String input, java.lang.Boolean append)The __StringToFile function can be used to write a string to a file. Each time it is called it writes a string to file appending or overwriting.- Parameters:
file- Path to file.input- The string to write to the file. If you need to insert a line break in your content, use \n in your string.append- The way to write the string, true means append, false means overwrite. If not specified, the default append is true.
-
stringToFile
public static java.lang.String stringToFile(@NonNull @NonNull java.lang.String file, @NonNull @NonNull java.lang.String input)The __StringToFile function can be used to write a string to a file. Each time it is called it writes a string to file appending or overwriting.- Parameters:
file- Path to file.input- The string to write to the file. If you need to insert a line break in your content, use \n in your string.
-
testPlanName
public static java.lang.String testPlanName()
The TestPlanName function returns the name of the current test plan (can be used in Including Plans to know the name of the calling test plan).
-
threadGroupName
public static java.lang.String threadGroupName()
The thread group name function simply returns the name of the thread group being executed.
-
threadNum
public static java.lang.String threadNum()
get thread number.- Returns:
- returns a number between zero and (max number of running threads minus one) .
-
time
public static java.lang.String time(java.lang.String format, Variable variableName)The time function returns the current time in various formats.- Parameters:
format- The format to be passed to SimpleDateFormat. The function supports various shorthand aliases, see below. If omitted, the function returns the current time in milliseconds since the epoch.variableName- The name of the variable to set.
-
time
public static java.lang.String time(java.lang.String format)
The time function returns the current time in various formats.- Parameters:
format- The format to be passed to SimpleDateFormat. The function supports various shorthand aliases, see below. If omitted, the function returns the current time in milliseconds since the epoch.
-
time
public static java.lang.String time()
The time function returns the current time in various formats.- Returns:
- returns the current time in milliseconds since the epoch.
-
timeShift
public static java.lang.String timeShift(java.lang.String format, java.lang.String dateToShift, java.lang.String valueToShift, java.lang.String locale, Variable variableName)The timeShift function returns a date in the given format with the specified amount of seconds, minutes, hours, days or months added.- Parameters:
format- The format to be passed to DateTimeFormatter. See DateTimeFormatter If omitted, the function uses milliseconds since epoch format.dateToShift- Indicate the date in the format set by the parameter 'Format' to shift If omitted, the date is set to now.valueToShift- Indicate the specified amount of seconds, minutes, hours or days to shift according to a textual representation of a duration such as PnDTnHnMn.nS. See https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#parse-java.lang.CharSequence- <p>PT20.345S parses as 20.345 seconds PT15M parses as 15 minutes PT10H parses as 10 hours P2D parses as 2 days -P6H3M parses as -6 hours and -3 minuteslocale- The string format of a locale. The language code must be lowercase. The country code must be uppercase. The separator must be an underscore. ex: en_EN See http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html If omitted, by default the function use the ApacheJMeter locale one.variableName- The name of the variable to set.
-
timeShift
public static java.lang.String timeShift(java.lang.String format, java.lang.String dateToShift, java.lang.String valueToShift, java.lang.String locale)The timeShift function returns a date in the given format with the specified amount of seconds, minutes, hours, days or months added.- Parameters:
format- The format to be passed to DateTimeFormatter. See DateTimeFormatter If omitted, the function uses milliseconds since epoch format.dateToShift- Indicate the date in the format set by the parameter 'Format' to shift If omitted, the date is set to now.valueToShift- Indicate the specified amount of seconds, minutes, hours or days to shift according to a textual representation of a duration such as PnDTnHnMn.nS. See https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#parse-java.lang.CharSequence- <p>PT20.345S parses as 20.345 seconds PT15M parses as 15 minutes PT10H parses as 10 hours P2D parses as 2 days -P6H3M parses as -6 hours and -3 minuteslocale- The string format of a locale. The language code must be lowercase. The country code must be uppercase. The separator must be an underscore. ex: en_EN See http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html If omitted, by default the function use the ApacheJMeter locale one.
-
urlDecode
public static java.lang.String urlDecode(java.lang.String url)
Decode a application/x-www-form-urlencoded string.- Parameters:
url- String with URL encoded chars to decode.
-
unescape
public static java.lang.String unescape(java.lang.String input)
Process strings containing Java escapes (e.g. \n and \t).- Parameters:
input- String containing Java escapes.
-
unescapeHtml
public static java.lang.String unescapeHtml(java.lang.String input)
Decode HTML-encoded strings.- Parameters:
input- String to unescape.
-
urlEncode
public static java.lang.String urlEncode(java.lang.String url)
Encode a string to a application/x-www-form-urlencoded string.- Parameters:
url- String to encode in URL encoded chars.
-
uuid
public static java.lang.String uuid()
The UUID function returns a pseudo random type 4 Universally Unique IDentifier (UUID)..
-
variableValue
public static java.lang.String variableValue(java.lang.String varName, java.lang.String defaultValue)The V (variable) function returns the result of evaluating a variable name expression. This can be used to evaluate nested variable references (which are not currently supported).For example, if one has variables A1,A2 and N=1:
${A1} - works OK ${A${N}} - does not work (nested variable reference) ${__V(A${N})} - works OK. A${N} becomes A1, and the __V function returns the value of A1
- Parameters:
varName- The variable to be evaluated.defaultValue- The default value in case no variable found, if it's empty and no variable found function returns the variable name.
-
variableValue
public static java.lang.String variableValue(java.lang.String varName)
The V (variable) function returns the result of evaluating a variable name expression. This can be used to evaluate nested variable references (which are not currently supported).For example, if one has variables A1,A2 and N=1:
${A1} - works OK ${A${N}} - does not work (nested variable reference) ${__V(A${N})} - works OK. A${N} becomes A1, and the __V function returns the value of A1
- Parameters:
varName- The variable to be evaluated.
-
xpath
public static java.lang.String xpath(@NonNull @NonNull java.lang.String file, @NonNull @NonNull java.lang.String xpath)The XPath function reads an XML file and matches the XPath. Each time the function is called, the next match will be returned. At end of file, it will wrap around to the start. If no nodes matched, then the function will return the empty string, and a warning message will be written to the JMeter log file.- Parameters:
file- a XML file to parse.xpath- a XPath expression to match nodes in the XML file
-
-