Supported Functions Reference
Use these functions to combine, format, or aggregate values extracted from an XML automation result file. Functions can simplify mapping expressions and eliminate the need for custom preprocessing of XML data.
Function | Purpose |
|---|---|
concat() | Combines two XML expression values into a single string. |
groupConcat() | Combines multiple values returned by an XML expression into a single string. |
concat()
Use concat() to combine two XML values with an optional separator.
Syntax:
concat(expression1, expression2, separator, strict)
Parameter | Description |
|---|---|
expression1 | The first XML expression. |
expression2 | The second XML expression. |
separator | Text inserted between the two values. |
strict | Controls how missing values are handled. |
Strict Parameter Values
Value | Result |
|---|---|
true | Returns an empty value if either expression cannot be resolved. |
false | Ignores missing values and concatenates the available values. |
<testsuite name="Operator">
<testcase name="Add"/>
</testsuite>Expression
concat("${testsuite:name}", "${testsuite.testcase:name}", "#", true)
Result
Operator#Add
groupConcat()
Use groupConcat() when an expression returns multiple values.
Syntax
groupConcat(expression, separator, strict)
Parameters
Parameter | Description |
|---|---|
expression | XML expression that returns multiple values. |
separator | Text inserted between each value. |
u | Controls how missing values are handled. |
Strict Parameter
Value | Result |
|---|---|
true | Returns an empty value if no matching values are found. |
false | Concatenates all available values. |
<testsuite name="Operator">
<testcase name="Add">
<error>Value must not be null</error>
<error>Value must be greater than 0</error>
<error>Value must be numeric</error>
</testcase>
</testsuite>Expression
groupConcat("${testsuite.testcase.error}", ";
", true)Result
Value must not be null; Value must be greater than 0; Value must be numeric
Note
Use concat() when you need to combine two known values.
Use groupConcat() when an expression can return multiple matching elements.
Select an appropriate separator to improve readability (for example, -, #, , , or ; ).
Use strict=true when all input values are required.
Use strict=false when missing values are acceptable.
Common Use Cases
Scenario | Recommended Function |
|---|---|
Create a unique test case name | concat() |
Combine test suite and test case names | concat() |
Build a descriptive summary | concat() |
Merge multiple error messages | groupConcat() |
Combine repeated XML element values | groupConcat() |