Testing the SHR module using SoapUI

What is SoapUI ?

SoapUI is a cross-platform Functional Testing solution. SoapUI allows you to easily and rapidly create and execute automated functional, regression, compliance, and load tests. It is available in both free and commercial versions.

It is ideal for the purposes of testing web service GET and POST requests.

Installing SoapUI

The latest version of SoapUI can be downloaded from here free of charge. Do NOT use the SoapUI eclipse plugin, as it does not allow us to make certain configuration changes that are essntial to operate the application on OpenMRS (see below for further information)

Testing the SHR module using SoapUI

To test the module, we need to build a SoapUI project which makes mock GET and POST requests.

A sample SoapUI containing four configurable GET and POST requests have already been created. You may download this file from ~suranga:here.

Now, import this file into your SoapUI instance by  file -> import project -> select file

Now, you may view the sample requests, duplicate them, or edit them as per your testing needs.

To view each test request, double click on the node.

Configuring the SoapUI instance

To configure your SoapUI instance for use, you need to make the following configurations.

Setting the user name / password to authenticate SoapUI to the system under test

For each test request, click on the 'auth' tab, and specify the current authentication credentials to the SHR server.

Making SoapUI authenticate pre-emptively

This ensures that SoapUI sends authentication headers with each request without first receiving an authentication challenge. This is essential to navigate OpenMRS's security restictions.

To configure SoapUI to authenticate pre-emptively, do the following -

SoapUI Global preferences -> HttpSettings ->  tick on the 'uthenticate pre-emptively' check box

Congradulations, now you are ready to test the application.

Testing the SHR for error conditions using SoapUI

To test out incorrect, or alternative use cases, try out this ~suranga:SoapUI file.

Issues with testing using SoapUI

There are two ways to validate a SoapUI test result. One way is to compare test results manually via the naked eye, while the second (correct way) to do it is via the use of assertions.

Unfortunately, assertions are not offered in the free version, and therefore cannot be used for our testing purposes. Therefore, e are restricted to comparing test results manually.