Test Automation With Plain SoapUI

Test Automation mit SOAP UI

Automation Illustration

Have you ever wanted to run some features that are only available in SOAP UI Pro?
Well, a little grasp of Groovy scripting can help you to simulate some of those high-falutin features
that would have cost you $$$ per year in licenses.  Here is one neat feature that I really like.

Running All Projects in a Workspace

This feature is not available in the free (community version) of SOAP UI, but the Groovy script
described in this post will do the same thing, without hurting your wallet.

Here are the steps for using the project file in SOAP UI

  1. Open or create a new Workspace in SOAP UI
  2. Add/import all the projects you want to run into the workspace
  3. Import the test harness SOAP UI project.  You can download the project file from > here <
  4. Remove any projects that are to be excluded
  5. Expand the “ExecutionHarnessExample” project and run the only TestStep – Groovy script “RunProject”

The script will loop through all the test Projects, TestSuites, TestCases and TestSteps, while also printing a summary of the progress to screen, and where indicated, logging the complete test logs to a file.  The script prompts the user for the path to the log file.  Accepting the default value “DO-NOT-LOG”, turns off logging.


Enter a valid path to enable logging.  The name of the log file is saved to a global property, so it is available even after the test run (in case you forget)


A useful feature of the script is that assertions are exercised, so you can see TestSteps turning green or red as they are being run!


The script is quite simple, and you can open it in SOAP UI for a detailed walk-through, but below are the salient things:

// Save the name of this automation project
//it will be needed later to prevent infinite looping
def executionProjectName = testRunner.testCase.testSuite.project.name// Get a handle on the SOAP UI workspace
def testWorkspace = testRunner.getTestCase().getTestSuite().getProject().getWorkspace();// Ask user to confirm if test output should be logged to default file
filePath = ui.prompt(…);// First, a loop is created for all the Projects in the in the SOAP UI Workspace
for (int projectCounter = 0; projectCounter < testWorkspace.getProjectCount(); projectCounter++) {// Exclude the automation project else you get an infinite loop!
if (testProject.name != executionProjectName) {// Exclude disabled TestSuites from the loop
for (… (!testProject.getTestSuiteAt(suiteCounter).isDisabled())); suiteCounter++) {// Create a TestRunner for running the TestSteps in this TestCase
testCaseRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null);// Run each TestStep in the TestCase
testStepResult = … testStep.run(testCaseRunner, testStepContext);// Log the output if requested
if ((filePath != null) && (filePath != ”) && (filePath != ‘DO-NOT-LOG’)) { testStepResult.writeTo(fileWriter); }// Close the output file when all Projects have been processed


At the end of the test run, you can view the log file in a text editor like TextPad and view the messages exchanged (including headers) as well as timings.


And that’s all folks; I hope you found the posting useful.
It has certainly helped me put off the purchase of a SOAP UI licence for another day 🙂
God bless!

Oyewole, Olanrewaju J (Mr.)
Internet Technologies Ltd.
Mobile: +44 [0] 793 920 3120


No comments yet. Why don’t you start the discussion?

Leave a Reply