All Products
Search
Document Center

Performance Testing:Combine system functions with strings

Last Updated:Mar 11, 2026

In PTS parameterized expressions, you combine system functions with strings or other functions by placing them next to each other. No concatenation operator is needed. All expressions start with =.

Quick reference

PatternSyntaxExample output
String + function=abc${sys.random(1,20)}abc5
Function + function=${sys.random(1,20)}${sys.select("a","b","c")}12b
Nested functions=${sys.substring("abc${sys.random(1,20)}", 0, 1)}a

Concatenate strings and functions

Place a string and a system function, or two system functions, next to each other. No separator is required.

String before a function

=abc${sys.random(1,20)}

If sys.random(1,20) returns 5, this produces abc5.

Two functions together

=${sys.random(1,20)}${sys.select("a","b","c")}

If sys.random(1,20) returns 12 and sys.select("a","b","c") returns b, this produces 12b.

Escape quotation marks in parameters

Single quotation marks (') inside function parameters do not need escaping. Double quotation marks (") must be escaped by doubling them ("").

Single quotation marks

Use single quotation marks directly:

=${sys.md5("leo say 'hi'")}

This computes the MD5 hash of the string leo say 'hi'.

Double quotation marks

Escape each " by writing "":

=${sys.md5("leo say ""hi""")}

This computes the MD5 hash of the string leo say "hi".

How the escaping works: the outer pair of " delimit the parameter. Each "" inside produces one literal " character. In the example above, ""hi"" resolves to "hi".

If you omit the doubled quotation marks, PTS interprets them as parameter delimiters. This causes unexpected parsing results or errors.

Use quotation marks in nested functions

When you pass a system function as a parameter to another function, double quotation marks (") around the inner function are not always required. Whether you need quotes depends on how the inner parameter is constructed:

ScenarioQuotes needed?Reason
Inner parameter is a single function callNoPTS resolves the function reference directly
Inner parameter involves string concatenationYesThe concatenated string must be enclosed in "
Inner parameter references a file parameterYesFile parameter values are treated as strings
Inner parameter is a JSON string with variablesYesThe JSON structure requires string delimiters

Single function as parameter (no quotes)

When the inner parameter is a standalone function call, omit the double quotation marks:

=${sys.substring(${sys.md5("${input1}${input2}")},2,5)}

The outer sys.substring receives the result of sys.md5(...) directly, so no quotes are needed around ${sys.md5(...)}. Inside sys.md5, the two inputs are concatenated (${input1}${input2}), so that concatenation is enclosed in ".

Evaluation order:

  1. ${input1} and ${input2} resolve to their values (for example, hello and world).

  2. sys.md5("helloworld") computes the MD5 hash.

  3. sys.substring(<md5-result>, 2, 5) extracts a substring starting from position 2 up to position 5.

String concatenation as parameter (quotes required)

When the function parameter is a string built by concatenation, enclose it in ":

=${sys.substring("abc${sys.random(1,20)}", 0, 1)}

The parameter "abc${sys.random(1,20)}" concatenates the string abc with the output of sys.random(1,20). Because this is a concatenated string, it must be enclosed in ". The result is always a (the first character of the concatenated string).

File parameter as input (quotes required)

When a function parameter comes from a data file, enclose it in ":

=${sys.base64("${num2}")}

${num2} is a file parameter loaded from a data file at runtime. File parameters inside functions must be enclosed in ".

JSON string with variables (quotes required)

When you construct a JSON string that references file parameters, enclose the JSON in " and escape internal double quotation marks by doubling them:

=${sys.select("{""username"":""${username}""}","blue","green")}

This sys.select call picks from three options:

  • {"username":"<value-of-username>"} -- a JSON object with the username file parameter

  • blue

  • green

Each "" inside the expression represents a literal " in the JSON string.