Testing Asynchronous Services using SoapUI

SoapUI is probably one of the best open source SOAP based web service testing tools out there, which has enough power to give other web service testing tools a run for their money. Note that although testing synchronous services is straight forward, testing asynchronous services require some additional configuration of the test case steps. In Testing Asynchronous Services using SoapUI, we will cover how to test an asynchronous service using SoapUI, by calling a simple asynchronous Hello World service – which in this case is implemented using Oracle SOA Suite components.

Please refer to the BPEL Hello World program article under SOA Suite section to understand how to develop Hello World SCA Composite using soa suite. Note that only difference in this example, is that we have created an Asynchronous Hello World BPEL component and we have added a simple Delay step to delay execution of the service by 5 seconds. Reason for addition of delay is explained in the conclusion section of the article.

Contents of this article are

Getting the Async Web Service Details

In order for testing Asynchronous services, we need details of the asynchronous service we are testing. For our article, we will take a simple Asynchronous hello world process implemented using BPEL SCA component in SOA Suite. Main things to note about this service are:

  • You can call process operation on the service to trigger the Hello world process
  • After receiving the input, the process waits 5 seconds
  • After the delay, it will generates Hello response
  • It will return the response back by calling processResponse operation

For testing any web service, we need the WSDL describing the service first. We can obtain the WSDL either from the developer or obtain it ourselves by going to enterprise manager console as shown below.

 

Creating SoapUI project and Test case

Creation of Asynchronous test case could be divided into three main sections namely:

  1. Create SoapUI project & Test Case
  2. Configure Test Case to call Asynchronous service
  3. Execute & validate the Test Case.

Create SoapUI Project & Test Case

Creation of SoapUI project & Test case is a straight forward process.

  • First create a new SoapUI project by importing the WSDL
  • Create a new Test Suite manually
  • Create a Test case inside the test suite

Detailed steps for creation of SoapUI project and test case is shown in the following Image Show.

Create a new SoapUI Project

Picture 1 of 6

Right click workspace and select new SoapUI Project

Configure Test Case to Call Asynchronous service

Steps involved in configuring the test case to call the async service is as follows:

  • Add a SOAP request step to call the Asynchronous Hello World Service
  • Add a Mock Response Step to wait for and receive the Asynchronous Response
  • Configure the Mock Response step with the desired port at which you want the HTTP listener to run and the path to receive the asynchronous responses
  • Configure the WS-Addressing Headers of the SOAP Request step with details of Mock Response Step configurations above
  • Optionally configure the test case to be modular by using Properties to specify the end point location. Note that at any of the fields used in SoapUI, you are able to do property expansion to insert dynamic values. The properties to hold configuration information could be stored at multiple levels like property test step or test case or test suite or project or globally.

Walk through of the above process with detailed steps are provided in the below image show.

Add SOAP Request step to the test case

Picture 1 of 12

In the test case, add the SOAP request step to the test case to call Hello World Service.

Execute & Validate Test Case

Steps involved in executing the test case are as follows:

  • Execute the entire test case by submitting the test case to run
  • Notice that the test case waits for the asynchronous response from the service
  • Once completed, click on the SOAP Request and Mock Response step entries in test case log to view the WS-Addressing headers populated in the request and response

Walk through of the above process with detailed steps are provided in the below image show.

Run the test case

Picture 1 of 3

Select the Green icon at the test case level to kick off the test case.

  

Conclusion

Some of the things to conclude from this example are:

  • SoapUI provides an easily configurable way of calling Asynchronous services
  • When the test case encounters the mock response step while executing,  the test case creates a HTTP listener on the configured port & path and waits for response to come from the server
  • In other words, if the service sends the response back before SoapUI test case has reached the mock response step (for example, if the web service executes within 100ms, but SoapUI tries to receive the response 200ms after execution) the service will error out!! This is because SoapUI doesn’t start a listener to receive responses till the mock response step is executed. This is one of the reasons why in the Async Hello World process I had introduced a delay of 5s (just to ensure that test case would definitely be waiting for a response)
  • SoapUI also provides mechanisms to correlate a response with a request (using Query Match option) – which is useful when you are running multiple instances of the test case at the same time (for concurrent or performance testing scenarios)

Share this:

About Chethan

I am the Founder and Director of Expertz.me! I am an Entrepreneur, Architect, Problem Solver & Techy - All rolled into one!!