Field Mapping Reference
This reference lists the supported mapping expressions for QMetry fields. Use these expressions when configuring field mappings in a Custom Automation Template.
A mapping expression can reference either an XML attribute or an XML element. The expression you use depends on how the data is stored in your XML file. For more information, see Mapping Expression Syntax.
The following XML is used throughout this reference to demonstrate the mapping expressions.
<testsuites name="Automation Regression">
<testsuite name="Login Tests"
tests="2"
failures="1"
skipped="0"
time="12.45"
testEntityKey="FT-TC-101 FT-TC-102"
requirementEntityKey="FT-RQ-201 FT-RQ-202"
requirementExternalKey="JIRA-123 JIRA-124">
<testcase name="Verify valid login"/>
<testcase name="Verify invalid login">
<failure message="Expected error message was not displayed"
type="AssertionError">
java.lang.AssertionError: Expected 'Invalid credentials' but found 'Login failed'
</failure>
</testcase>
</testsuite>
<testsuite name="User Management Tests"
tests="2"
failures="0"
skipped="1"
time="8.32">
<testcase name="Create new user"/>
<testcase name="Delete inactive user">
<skipped message="Test skipped because prerequisite data was unavailable"
type="Skipped"/>
</testcase>
</testsuite>
</testsuites>How to read this reference
Each mapping table uses four columns, described in the following list:
QMetry Field: the destination field in QMetry that stores the value.
Description: what the field maps and when it applies.
Expression: the mapping expression to enter. An Attribute expression uses a colon before the final segment; an Element expression uses a dot.
Result: the value the expression returns for the sample XML in this reference.
Note
The expressions in this topic return values from the sample XML shown above. Your expressions should match the structure of your XML file
Test Case Fields
Use the following expressions to map Test Case fields.
QMetry Field | Description | Expression | Result |
|---|---|---|---|
Test Case Summary (Required) | Maps the test case name or summary. | ${testsuites.testsuite.testcase:name} | Verify valid login |
Test Case Entity Key | Maps an existing QMetry test case using its entity key. | ${testsuites.testsuite:testEntityKey} | FT-TC-101 FT-TC-102 |
Test Case Tag (mandatory) | Maps the XML test case node. | ${testsuites.testsuite.testcase} | - |
Note
All existing Automation API rules apply to the Test Case Entity Key mapping.
Test suite name is auto-generated if unmapped, whereas the test case name is referenced from the file.
Test Step Fields
Use the following expressions to map Test Step fields.
Note
Step mappings apply only if the XML contains a <steps> element.
QMetry Field | Description | Expression | Result |
|---|---|---|---|
Step Description | Maps the test step description. | ${testsuites.testsuite.testcase.steps.step:name} ${testsuites.testsuite.testcase.steps.step.name} | - |
Note
If your XML supports additional step fields (Expected Result, Actual Result, etc.), add them here following the same pattern.
Test Suite Fields
Use the following expressions to map Test Suite fields.
QMetry Field | Description | Expression | Result |
|---|---|---|---|
Test Suite Summary | Maps the name attribute of each <testsuite> | ${testsuites.testsuite:name} | Login Tests |
Test Suite Tag | Maps the XML test suite node. | ${testsuites.testsuite} | - |
Requirement Fields
QMetry Field | Description | Expression | Result |
|---|---|---|---|
Requirement Entity Key | Maps an existing requirement using its entity key. | ${testsuites.testsuite:requirementEntityKey} | FT-RQ-201 FT-RQ-202 |
Requirement External Entity Key | Maps requirements synchronized from an external tracker, such as Jira or Azure DevOps. | ${testsuites.testsuite:requirementExternalKey} | JIRA-123 JIRA-124 |
Requirement Mapping Rules
Scenario | Result |
|---|---|
Requirement Entity Key exists | QMetry associates the imported test case with an existing requirement by its entity key. |
Requirement External Entity Key exists | QMetry associates the imported test case with an existing requirement by its external entity key. |
Both internal and external keys exist | QMetry uses the Requirement Entity Key. |
Requirement does not exist | QMetry skips the association. The import continues. |
Automatic Field Behavior
Field | Behavior When Unmapped |
|---|---|
Test Case Summary | Required. The import cannot proceed without it. |
Test Suite Summary | QMetry generates a test suite name automatically. |
Other Optional Fields | QMetry leaves the fields empty if they are not mapped or if the XML file does not contain the required information. |
Multiple Value Support
Some fields accept multiple values, as described in the following table.
Field | Format |
|---|---|
Test Case Entity Key | Separate multiple keys with a space. |
Requirement Entity Key | |
Requirement External Entity Key |
Execution Fields
Use the following expressions to map Execution fields.
QMetry Field | Description | Expression | Result |
|---|---|---|---|
Start Time | Maps the execution start time. | ${testsuites.testsuite:start} | - |
End Time | Maps the execution end time. | ${testsuites.testsuite:end} | - |
ExecutionTime | Maps the execution duration. | ${testsuites.testsuite:time} | 12.45 |
Execution Status Fields
Use the following expressions to map the counts that QMetry uses to resolve execution status.
QMetry Field | Description | Expression | Result |
|---|---|---|---|
Execution Status | Maps the execution status of a test case | ${testsuites.testsuite.failures} | 1 |
Execution Status | Maps the execution status of a test case | ${testsuites.testsuite.skipped} | 1 |
Note
For details on status resolution, default status, and fallback rules, see Execution Status Mapping Reference.
Error Fields
Use the following expressions to map Error fields.
QMetry Field | Description | Expression | Result |
|---|---|---|---|
Error Message | Maps the failure message. | ${testsuites.testsuite.testcase.failure:message} | Expected error message was not displayed |
Stack Trace | Maps the failure details. | ${testsuites.testsuite.testcase.failure} | java.lang.AssertionError... |