JMeter functions are no different from normal languages like C, C++, Perl etc. These functions take some parameters and return some value after processing those arguments. By convention, JMeter function names always starts with '__' i.e. two underscores. 
A typical function call looks like:
where:
FunctionName maches any function name like __XPath
NOTE: If a function parameter contains a comma, then be sure to escape this with "\", otherwise JMeter will treat it as a parameter delimiter. For example:
Source: http://jmeter.apache.org
A typical function call looks like:
${__FunctionName(var1,var2)}
where:
FunctionName maches any function name like __XPath
NOTE: If a function parameter contains a comma, then be sure to escape this with "\", otherwise JMeter will treat it as a parameter delimiter. For example:
${__time(EEE\, d MMM yyyy)}. 
If the comma is not escaped, you will get an error such as:
ERROR - jmeter.functions.JavaScript: Error processing Javascript: [Math.max(2] org.mozilla.javascript.EvaluatorException: missing ) after argument list (#1) 
LIST of functions:
| Type of function | Name | Usage | 
|---|---|---|
| Information | threadNum | get thread number | 
| Information | samplerName | get the sampler name (label) | 
| Information | machineIP | get the local machine IP address | 
| Information | machineName | get the local machine name | 
| Information | time | return current time in various formats | 
| Information | log | log (or display) a message (and return the value) | 
| Information | logn | log (or display) a message (empty return value) | 
| Input | StringFromFile | read a line from a file | 
| Input | FileToString | read an entire file | 
| Input | CSVRead | read from CSV delimited file | 
| Input | XPath | Use an XPath expression to read from a file | 
| Calculation | counter | generate an incrementing number | 
| Calculation | intSum | add int numbers | 
| Calculation | longSum | add long numbers | 
| Calculation | Random | generate a random number | 
| Calculation | RandomString | generate a random string | 
| Calculation | UUID | generate a random type 4 UUID | 
| Scripting | BeanShell | run a BeanShell script | 
| Scripting | javaScript | process JavaScript (Mozilla Rhino) | 
| Scripting | jexl, jexl2 | evaluate a Commons Jexl expression | 
| Properties | property | read a property | 
| Properties | P | read a property (shorthand method) | 
| Properties | setProperty | set a JMeter property | 
| Variables | split | Split a string into variables | 
| Variables | V | evaluate a variable name | 
| Variables | eval | evaluate a variable expression | 
| Variables | evalVar | evaluate an expression stored in a variable | 
| String | regexFunction | parse previous response using a regular expression | 
| String | escapeOroRegexpChars | quote meta chars used by ORO regular expression | 
| String | char | generate Unicode char values from a list of numbers | 
| String | unescape | Process strings containing Java escapes (e.g. \n & \t) | 
| String | unescapeHtml | Decode HTML-encoded strings | 
| String | escapeHtml | Encode strings using HTML encoding | 
| String | TestPlanName | Return name of current test plan | 
Source: http://jmeter.apache.org
 
 
No comments:
Post a Comment
Please Comment for Any question or suggestions