Automated SoapUI Tests

Continuous Integration: SoapUI + Jenkins

Automated SoapUI Tests

Overview

Nowadays, Continues Integration can be done by using a single command line and by combining the correct tools. This tutorial will show you how to execute your existing SoapUI projects without performing all the necessary manual tasks. For that, we will give use of Jenkins capabilities to launch the default command-line tools available on SoapUI.

Requirements

  1. Jenkins (I’ve used version 2.32.2);
  2. SoapUI (I’ve used version 5.3.0);
  3. SoapUI Projects containing some TestSuites/TestSteps to be executed;
  4. SoapUI test cases built in a way where they are executed without manual intervention;

Steps

1) Let’s create a Jenkins workspace to organize all our assets

On the Jenkins main page, click on ‘New Item’. This will guide you to a new page where you should insert your desired project name (ex: Automated Tests) and select the ‘Freestyle project’ option. Click ‘OK’, and ‘Save’ just empty as it is.

Click on ‘Build Now’ so the workspace directory gests created in the filesystem.

If you check the filesystem, a new folder should have been created inside the location where Jenkins is installed (..\\Jenkins\Workspace\...). This will be your central location, where you should place all your SoapUI .xml projects.

2) Now regarding the SoapUI Projects

Create (or Export if you already have them) all your SoapUI projects in .xml format. When saving them, make sure that they are stored inside the Jenking location from the previous steps (inside your Jenkins project):

  1. F:\\Jenkins\Workspace\EXAMPLE_NAME\

On the same level as the SoapUI.xml project, create also a \bin folder. This folder will be the one where you are going to store the test results outputted by SoapUI. This is how it should look like after this step:

3) Lets integrate Jenkins with SoapUI

Go back your Jenkins project. Go into the Build section and select ‘Execute Windows batch command’. In here you will insert the command which will execute the SoapUI and return the test results.

Use the following command which I will describe below:

D:\SOAP-UI-LOCATION\bin\testrunner.bat -r -a -j -f"JENKINKS-WORKSPACE-LOCATION\bin" -GworkspaceDir="JENKINKS-WORKSPACE-LOCATION" "JENKINKS-WORKSPACE-LOCATION\You-soapUI-project.xml"

  • SOAP-UI-LOCATION = location where you SoapUI was installed and where you can find the testrunner.bat
  • JENKINKS-WORKSPACE-LOCATION = location that you have previously created while building your job. You should be able to find you SoapUI Project in this same directory
  • –r = Turns on printing of a small summary report
  • –a = Turns on exporting of all test results, not only errors
  • –j = Turns on exporting of JUnit-compatible reports – This is an important step, since Jenkins will consume this files to make the UI part. This step will be explain right after.
  • –f = Specifies the root folder to which test results should be exported
  • -G = Sets global property with name=value
  • For more details about the command options please have a look here.

To validate if the above command is correct, you can even open a Command Prompt and run it manually to see if it is generating any kind of JUnit files;

After completing the step above, lets create a new post-build action of ‘Publish JUnit test result report’. The field ‘Test report XMLs’ should point exactly to the JENKINKS-WORKSPACE-LOCATION\bin location used on the command above but pointing to the XML files.

4) Running it

Save your changes and… That’s it. If everything was done correctly you should be able to see a ‘Test Result Trend’ graphic on the main page of your project, just like below:

You should also be able to drill-down all you SoapUI project and see where it failed, in case of error.

Leave a Reply

Your email address will not be published. Required fields are marked *