Configure Ant Task for Running SoapUI as JUnit Test

There have been some blog posts regarding running SoapUI using either testrunner.bat or scripts coming with SoapUI installation. You can choose either bat or sh script based on your OS. But what if I need a solution that works on both Windows and Linux? There  are also posts mentioning reading the SoapUI project file and creating custom JUnit test class to run each test case inside test suite. Is there another way ?

What “testrunner” does is simply to run a Java program (with as Main class) and generates JUnit reports.  What we can do is to configure an Ant task running the very same Java class with the same configurations.

Ant Task Configuration

Ant target configuration

After running this target, JUnit reports will be generated in the pre-defined directory. If you are using CI server (such as Bamboo), since build plan is configured to look for JUnit results, in the email sent out by Bamboo after each build you can see which test case failed if any.    Voilà

Configure Ant Task for Running SoapUI as JUnit Test