The soapui maven-plugin allows soapui TestSuites / TestCases to be run via the command-line as a maven goal. If any of the tests fail, an error will be printed to the console and the execution will exit with an error.
Download the latest version of the plugin from sourceforge or install it directly from the command-line:
maven plugin:download -DgroupId=eviware -DartifactId=maven-soapui-plugin -Dversion=1.0 -Dmaven.repo.remote=http://www.soapui.org/repository
Alternatively you can specify a dependency directly in your project.xml;
<dependency> <groupId>eviware</groupId> <artifactId>maven-soapui-plugin</artifactId> <version>1.0</version> <type>plugin</type> </dependency>
In this case, dont forget to add the soapui repository to your repository list in project.properties;
maven.repo.remote=http://www.ibiblio.org/maven,http://www.soapui.org/repository
Download/install the plugin as described above. By default, the plugin will look for a
soapui project file
named ${pom.artifactId}-soapui-project.xml
, you can override this by setting with the
maven.soapui.project
property.
Run the tests with
maven soapui:test
The plugin will load the specified project file and run all TestCases available in all TestSuites. If you
want to narrow down which TestSuites/TestCases to run, use the maven.soapui.test.testsuite
and
maven.soapui.test.testcase
properties for that purpose.
If you want to change the service endpoint URL used by the TestRequests in the executed TestCases, set this
with the maven.soapui.test.endpoint
property, for example
maven soapui:test -Dmaven.soupui.test.endpoint=http://somehost.com:8080/services/MyService
Be aware that this will set the endpoint for all TestRequests executed, you might need to narrow down which TestCase to run if you have multiple TestCases testing multiple services.
For example if you have 2 TestSuites, each testing its own service in your project, you could run these as follows;
maven soapui:test -Dmaven.soupui.test.testsuite=TestSuite1 -Dmaven.soupui.test.endpoint=http://somehost.com:8080/services/MyService1
followed by
maven soapui:test -Dmaven.soupui.test.testsuite=TestSuite2 -Dmaven.soupui.test.endpoint=http://someotherhost.com:8080/services/MyService2