Adding Xpath query verification points
With service query verification points, you can check that a response matches an Xpath query.
Before you begin
When you add verification points, the results from a service response are compared with the expected data that is specified in the verification point test element. With query verification points, you can check that the number of nodes returned by an XML Path language query matches the expected number of nodes specified in the verification point.
Refer to the XPath specification for details on expressing an XPath query: http://www.w3.org/TR/xpath.
You can use the test editor to create or edit verification points.
Procedure
- Open the test editor, and select a web service response element.
- Click Add, and select Query verification point.
- In the Test Element Details area of the test editor, type a name for the verification point.
- Type a valid XPath expression or
click Build Expression to open the XPath Expression Builder.The XPath Expression Builder helps you build and evaluate XPath expressions based on the recorded contents of the response.
- Specify a Comparison operator (=, >, or <), and the expected number of nodes that the query should return. Click Evaluate to update the Expected Count with the actual result based on the recorded contents of the response.
What to do next
Note: Because
XPath expressions require that the qualified name have a prefix, XPath
expressions will return null for the default namespace declared with xmlns.