Built-in Functions in JMeter

Q

What are built-in functions in JMeter?

✍: FYIcenter.com

A

Built-in functions are functions provided by JMeter that allows you access JMeter/JVM properties, manipulate data, and run scripts.

Below is the syntax of calling a built-in function.

${__functionName(param1,param2,param3)}

Note that if a parameter contains a ",", it must be escaped as "\,". For example: the following function returns 5:

${__javaScript(Math.max(2\,5))}

List of some commonly used built-in functions:

  • __machineName() - Returns the local machine name.
  • __time() - Returns time formatted with a given pattern.
  • __log() - Logs a message.
  • __StringFromFile() - Reads a line from a file.
  • __FileToString() - Reads file contents.
  • __CSVRead() - Reads a file in CSV format.
  • __XPath() - Extract data with an XPath from an XML file.
  • __intSum() - Adds two integers.
  • __longSum() - Add two long integers.
  • __Random() - Generates a random number.
  • __RandomDate() - Generates a random date.
  • __RandomString() - Generates a random string.
  • __groovy() - Runs a Groovy script.
  • __javaScript() - Generates an JavaScript code.
  • __property() - Runs the value of a given JMeter/JVM property.
  • __P() - Same as __property().
  • __setProperty() - Sets new value to a JMeter property.
  • __split() - Splits a string with a given delimiter.
  • __regexFunction() - Parses the output with a regular expression.
  • __char() - Generates a Unicode character.
  • __unescape() - Un-escape a Java encoded string.
  • __unescapeHtml() - Un-escape an HTML string.
  • __escapeHtml - Escape an HTML string.
  • __escapeXml() - Escape an XML string.
  • __urldecode() - Decodes a URL encoded string.
  • __urlencode() - Encodes a URL string.
  • __TestName() - Returns the file name of the test plan.

 

JMeter Test Elements and Execution Order

System Properties in JMeter

Variables and Functions in JMeter

⇑⇑ Apache JMeter Tutorials

2018-01-27, 3884🔥, 0💬