XPath checkpoints
Relevant for: API testing only
For steps with XML output properties, such as Web Service, SOAP Request, and String to XML, you can validate the test results against XPath expressions. Specify a fully qualified XPath expression or instruct UFT One to ignore the namespaces and prefixes during the test run.
In the following example, to retrieve the contents of the second node, B, you would need to write an expression that also indicates the namespace, such as //*[local-name(.)='Node' and namespace-uri(.)='ns2'].
<Root>
<Body>
<Node xmlns="ns1">A </Node>
<Node xmlns="ns2">B </Node>
</Body>
</Root>
When working with simple XPath expressions, further simplify the XPath expression by selecting Ignore namespaces. In the above example, the expression //Node[2] is sufficient to evaluate the value B in the second node.
UFT One also enables you to evaluate XML with namespace prefixes. For example, if the XML contains the prefix definition xmlns:T="ns1", you can specify the prefix in the XPath expression: //T:NodeName. To evaluate namespace prefixes, disable the Ignore namespaces option.
XPath checkpoints can only be used when the XPath query returns a scalar value—not XML.
For task details, see Set XPath checkpoints.