Point and Click Testing with XPath

In this guide you'll learn how to leverage Point and Click Testing in SoapUI Pro. You'll learn how to easily add one response into another request, how to use XPATH assertions, and how to leverage it in Groovy scripts. This feature is only available in standalone SoapUI Pro that has been superseded by SoapUI Pro in the ReadyAPI platform. To try the new functionality, feel free to download a SoapUI Pro trial before starting, if you don't have it.

Watch the video tutorial:




An example using Xpath with an XML response.

XPath Example

In a project we have a Simple Search TestCase that declares a username/password, calls a login action to get the session ID, then calls a search with the session id parameter, and finally calls logout with the session ID parameter.

The login request already has a good randomized username parameter, but for demonstration purposes we will replace that with the sessionID from the response.

The TestCase contains the steps:


The login TestStep contains the request


  • Open the login TestStep
  • Run the request

In the response tab we can see that we received a sessionid in response:


  • Right-click the login field


  • Browse in the context menu down to the login request and select the response property

The Select Xpath dialog opens:


  • Pick the sessionid node

This generates the required XPATH automatically in the lower frame.

  • Click OK

The expansion is created and added to the login field:

${Test Request - login#Response#declare namespace sam='http://readyapi.smartbear.com/sample/'; //sam:loginResponse[1]/sessionid[1]}

And if we run the request again, wer can see the actual session ID value has been used in the Raw request view:


XPATH Assertions

XPATH assertions are very useful when validating your test runs. Using the Get Data point and click feature, you can quickly add assertions to validate particular aspects of your service.


We have a request and response for the currency conversion web service:


Let's say we want to check that the response returns a reasonable value. One way is to use a XPath Match assertion since it can look directly at an element value.


  • Click {{/icon/system/add.png}} Add assertion

The assertion selection dialog opens:


  • Open the Property Content category
  • Pick the XPath Match
  • Click Add

The assertion is created, and we can use the Get Data feature to pick the element:


  • Click {{/icon/system/select_xpath.png}} Select XPath

The Response Outline shows the elements. In that view, we can select the element to create an XPath expression needed to select the value from the SOAP response:


  • Select ConversionRateResult
  • Click OK

The XPath Expression is created for us, and the Expected Value is picked from the element value:


Since the expected value is very specific - a lot of decimals - we want to tweak it a bit.


  • Check the Allow Wildcard box
  • Replace everything after the decimal point with an asterisk (the wildcard)

The Assertion will now evaluate to Valid for all responses where the value starts with 8.

XPath Wizard

In ReadyAPI creation of an XPath statement is extremely easy; the top left button in the XPath Match configuration dialog opens a dialog that allows you to select the desired target node for the XPath expression, which will then be created automatically for you.



(Clicking OK in the dialog inserts the selected XPath statement into the editor field)

ReadyAPI also adds a number of wizards to the right-click popup menu of outline view of the response message; right-clicking the node you want to assert in the outline view opens the following popup:


The first four options here all create preconfigured XPath assertions for you, for example selecting the "for Existence" option creates the following XPath Assertion;


If we instead had selected the "for Content matching RegEx" option, we would first have been prompted for a regular expression that should be used to validate the selected node;


here we specified the .\d regular expression which matches just numbers (see this page for a regex reference), after clicking OK we get