How To… SoapUI: Using Docker To Execute Tests in Soap UI

Every month on the third Thursday as part of our How To…Series, we feature a new post with a guide on how to solve a particular problem with SOAP UI with guest blogger Brendan Connolly. This month’s post looks at SOAP UI with Docker.

You can browse previous posts in the How..To SOAP UI series

How To…Use Dynamic Properties

How To…Test Client Timeouts and Delays

How To..Manage Basic Requests and Response Logging

How to…complete Parsing With Groovy

How To…Rest Without Wadl

If you want to check out other posts in the How To Series on Appium and Selenium, you can view them here.

 

—————————————————————————————————————————

So you have a SoapUI project setup and you have built out a nice a test suite, so what’s next? Tests are no good if you aren’t running them, and even better running them regularly.

You may want to add SoapUI to a nightly build or possibly even include it in your continuous integration pipeline. The challenge can be that SoapUI will have to be installed and your project file available for test execution.

Soap UI With Docker

To solve that problem we can use Docker. The heavy lifting has already been done thanks to a container created by Daniel Davidson. In his words:

By containerizing SoapUI and its runner, this allows you to have a portable SoapUI installation that lets you run your SoapUI projects anywhere!

Here’s how to run your SoapUI tests anywhere using docker and executing a few shell commands.

Installing Docker

For this How to, I have Docker for Mac installed locally on my laptop, but any system that can run a linux docker container will do.

If you are a Windows user don’t worry, Windows 10 supports running linux containers but best to check the docs

Installing the Container

Run the following command and docker will reach out to the [Docker Hub]() to pull down the docker file. If you aren’t familiar with Docker Hub, think of it as github for containers.

This command will install and start the SoapUI container:

 docker run --name soapie -d -p 3000:3000 ddavison/soapui

You should  start to see  Docker downloading and installing the necessary pieces for the container.

SOAP UI with Docker ContainerInstallProgress

Executing Tests

The container uses two simple http requests for interaction.

Get

We can drop that http://localhost:3000 into a browser and we’ll see the following landing page:

SOAP UI with Docker

Post

As you can see the status pag has instructions for sending the cUrl request for executing tests.

At this point we basically follow those instructions and using cUrl, or your favorite client to POST the project file and test suite name.

 curl --form "project=@/path/to/soapui-project.xml" \ --form "suite=TestSuite" \ http://localhost:3000/

Test Results

The http status code is your first indicator for of your tests results.

  • 200 All Tests Passed
  • 550 Test Failure(s)
  • 551 No Suite
  • 552 No Project
  • 500 Exception Running Tests

Test output is also returned in the http body of the response.

This information and more details can be found at this containers Docker Hub Page

Cleaning Up

The following commands can be used to stop or remove the container once you are done using it.

docker stop soapie

docker stop {id}

To remove

docker rm soapie

docker rm {id}

 

About the Author

Brendan

I am a Software Design Engineer in Test based out of Santa Barbara, California. Working in a variety of testing roles since 2009. I am responsible for creating and executing testing strategies and using his coding powers for developing tooling to help make testers lives easier. He writes tests at all levels from unit and integration tests to API and UI tests. I blog on testing and automation at Brendanconnolly.net or follow me on Twitter @theBConnolly
Find out more about @brendanconnolly