Mapping Expression Syntax

A mapping expression specifies the location of a value in the XML document. During the import, QMetry evaluates the expression and populates the corresponding field.

Expression Format

Use the following format to reference XML data:

${testsuites.testsuite.testcase:name}

Symbol

Purpose

${}

Encloses the expression.

.

Navigates between XML elements.

:

References an attribute of the current XML element.

Mapping XML Data

QMetry supports two types of XML data:

Data Type

Example

XML element

${testsuite.testcase.name}

XML attribute

${testsuite.testcase:name}

The expression syntax defines how values are extracted from the source XML structure and mapped to the corresponding QMetry fields during the import process.

Syntax Rules

  • Expressions must begin with $.

  • The complete expression must be enclosed in {}.

  • XML elements are separated using a dot (.).

  • Attributes are referenced using a colon (:).

  1. Mapping XML Attributes

    <testcase name="LoginTest" time="1.2"/>

    Expression : ${testsuite.testcase:name}

    Result: LoginTest

  2. Mapping XML Elements (Tags)

    <testcase> <name> LoginTest </name> </testcase>

    ${testsuite.testcase.status}

    Result: LoginTest

  3. Mapping Combination of Elements and Attributes

    <testsuite><testcase name="LoginTest">
        <status>Passed</status>
    </testcase></testsuite> 

    Attribute Expression : ${testsuite.testcase:name}

    Element Expression : ${testsuite.testcase.name}

    Result: LoginTest

Publication date: