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 it XPATH assertions, and how to leverage it in Groovy scripts. This feature is only available in SoapUI Pro, so you should download SoapUI Pro Trial before starting, if you don't have it.
Watch the video tutorial:
The step-by-step guide:
1. Point and Click testing from one response into anotherrequest
Expansion and XPATH
support in SoapUI offer great functionality, there is a little known Pro
feature of “Point and Click Testing” that leverages Property
Expansion and XPATH
to make creation of tests intuitive and user friendly. In this article you will see how you can
write complicated dynamic references to project properties and XML elements in
SoapUI Pro with point and click functionality.
All you have to do most times is: right-click and browse “Get Data” section.
Let’s have a look at our sample
project. In that 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.
Now I can call the login action to see the
structure of the response:
What I want to do is pass the “sessionid”
element from Login response in my search request call.
As you can see from image below, simply
right-click on the request field you want to populate, highlight “Get Data” and
browse to the login response:
The outline view of the response will pop up
in the “Select XPATH” window where you can select the element you need. That selection will generate the required
After clicking OK, the required Property Expansion string will
populate in the request:
Request: login#Response#declare namespace sam='http://www.soapui.org/sample/';
And if you run the request, you can see the
actual session ID value has been used in the Raw request view:
2. Point and Click testing in XPATH Assertions
XPATH assertions are very important in
validating your test runs. Or at least they
will be after you see how easy it is to validate specific response XML elements.
Take a look at the following XML response I
received from my “Hello Name” web service:
If I want to check that my response includes
the word “Hello”, I can’t really apply the “Contains” assertion since it will
look at the XML element name. So to look
directly at the element value, we should use the “XPATH Match” assertion:
In SoapUI Pro, clicking the highlighted
icon brings up the Outline view of the response. In that view, you can select the element that
will create the XPATH needed to select the value from the SOAP response:
Once you click OK, you can see both the
XPATH and Expected Result have been populated, as shown below:
As shown above, this will verify the
message "Hello SmartBear." Let's further enhance this so it will
match any name. Just check the “Allow Wildcard” box and replace
"SmartBear" with an asterisk, as shown below.