Point and Click Testing

In this guide you'll learn how to leverage Point and Click Testing in ReadyAPI. 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.

Watch the video tutorial:

The step-by-step guide:

1. Point and Click testing from one response into anotherrequest

While Property 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 ReadyAPI 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 XPATH:

After clicking OK, the required Property Expansion string will populate in the request:

${Test Request: login#Response#declare namespace sam='http://www.soapui.org/sample/'; //sam:loginResponse[1]/sessionid[1]}

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 ReadyAPI, 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.

3. Point and Click testing in Groovy script

Sometimes you have to resort to scripting in your testing scenarios;  for example, if you want to control the flow of Test Case steps with a Groovy script.  So let’s say you use dynamic endpoint functionality to specify whether you are pointing to Development, Testing, or Production environments, and based on the environment you want to go to a specific sign in step.

In this case we need to get the value of a custom, project-level property “ServiceEndpoint”:

You can then create your Groovy script.  In the text field right-click, select “Get Data”, browse to the project property and select it.

As this action will create the variable, you will be prompted to provide the variable name:

Once you click OK ReadyAPI will create the variable declaration:

Now you can continue coding your scenario based on the value of that preference: