JMeter functions

JMeter functions are special values that can populate fields or any sampler or other element in the test plan. They take the following form:

${__functionName(var1,var2,var3)} 

Here, __functionName matches one of the many function names JMeter offers. Parentheses surround the parameters sent to the function, which can vary from function to function. Functions with no parameters don't need the parentheses, for example, ${__threadNum}. A list of all available functions can be found on JMeter's website at http://jmeter.apache.org/usermanual/functions.html. Functions are divided into seven main categories. They are given here, along with their examples:

  • Information: threadNum, machineIP, time, and so on
  • Input: CSVRead, XPath, and so on
  • Calculation: counter, Random, UUID, and so on
  • Scripting: javaScript, BeanShell, and so on
  • Properties: property, P, setProperty, and so on
  • Variables: split, eval, and so on
  • String: char, unescape, and so on

Functions can prove useful in certain situations, allowing the computation of new values at runtime based on previous response data, such as which thread the function is in, time, and numerous other sources. Their values are generated afresh for every request throughout the course of the test. There are also some restrictions regarding where certain functions can be invoked. Since JMeter thread variables are not fully initialized when functions are processed, variable names passed as parameters will not be set up. This causes variable references to not work.

Functions are shared between threads in the test plan. Each occurrence of a function call is handled by a separate function instance.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.79.59