SoapUI in Test Driven Development approach

In my last project we had to provide a Web Service interface to an ECM (Enterprise Content Management) system to realise CRUD operations (Create, Read, Update, Delete). During implementation we used SoapUI and we have built some test scenarios such as nominal and alternative (exceptions) use case tests. These scenarios were used for stress and load testing, and integrated into Hudson to achieve very high quality services.

SoapUI-logo

As mentioned in  a previous post on this blog Testing with Eviware SOAP UI written by Josselin Lebret, SoapUI is one of the best tools in a Web Services development environment (SOAP, REST etc.).

In the context of  TDD, you can find some articles focusing on SoapUI versus JUnit, but these are no longer relevant as SoapUI also provides some interesting solutions to reuse your TestSuites developed with the SoapUI interface, in your unit and integration test environment.

The use of SoapUI, in conjunction with Maven and Jetty Server, allows for building significant unit tests, and somehow even functional tests.

In my last project we had to provide a Web Service interface to an ECM (Enterprise Content Management) system to realise CRUD operations (Create, Read, Update, Delete). During implementation we used SoapUI and we have built some test scenarios such as nominal and alternative (exceptions) use case tests. These scenarios were used for stress and load testing, and integrated into Hudson to achieve very high quality services.

To reuse the SoapUI TestSuite in your test environment you have 2 solutions (although these may not be the only ones):

Firstly, you match the classic JUnit approach by writing a JUnit test case and using the SoapUI wrappers to run the TestSuite/TestCase/TestStep from your TestSuite xml file. This is done with a few lines of code.

In the second one, you do not have to write a line of code, but just add some lines in the project's POM to launch the SopaUI TestSuite during a Maven build phase (test, integration-test).

These two solutions, used in conjunction with the Jetty plugin, allow you to easily develop complex (or not so complex) unit tests and to run them in your Continuous Integration environment. All is based on Maven life cycle and plugins, and can run in a standalone environment without deploying the Web Services on a separate server. The Maven build and test process is the following:

  • build the war file for the Web Service project
  • start the Jetty server with the war file
  • run the SoapUI test suite
  • stop the Jetty server

The SoapUI integration is not limited to just this. It also allows you to test your Web Service clients by providing a way to reuse the mock web services created within the SoapUI interface. This may be very helpful when your Web Services are backed by a server architecture too complex to be built in a standalone environment.

Being so easy and powerful, it would be a shame not to use it!

Resources:

Digital news!

Are you as digitally addicted as we are? We can supply you with a regular dose of digital news. Simply sign-up, or click to Follow us online.

About the author

Jacques Desmazières
Jacques Desmazières

J2EE/Java senior consultant. Expert in Software architecture and technical design, and involved in the b-i quality commitee. Before working for blue-infinity he was the technical director of a banking software editor on the French Riviera and also spend some years as a system integration consultant.