soapui includes a plugin for maven allowing soapui TestSuites / TestCases to be run as a maven goal. If any of the tests fail, an error-message will be printed to the console and the execution will exit with an error.
Prior to installing a new version of the plugin, you should delete any old versions from you local cache/repository/maven installation.
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, username, password or domain used by the TestRequests in the executed
TestCases, set this with one of the maven.soapui.test.XX
properties, for example
maven soapui:test -Dmaven.soapui.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.soapui.test.testsuite=TestSuite1 -Dmaven.soapui.test.endpoint=http://somehost.com:8080/services/MyService1
followed by
maven soapui:test -Dmaven.soapui.test.testsuite=TestSuite2 -Dmaven.soapui.test.endpoint=http://someotherhost.com:8080/services/MyService2
Here comes an example output when running soapui tests through maven as described above using the sample project included in the offline distribution:
maven soapui:test -Dmaven.soapui.project=sample-soapui-project.xml __ __ | \/ |__ _Apache__ ___ | |\/| / _` \ V / -_) ' \ ~ intelligent projects ~ |_| |_\__,_|\_/\___|_||_| v. 1.0.2 build:start: soapui:test: [echo] Running soapui project sample-soapui-project.xml with endpoint [] [java] SoapUI 1.0 TestRunner [java] 23:57:56,258 INFO [SoapUITestCaseRunner] setting projectFile to [sample-soapui-project.xml] [java] 23:57:56,838 INFO [WsdlProject] Loaded project from [sample-soapui-project.xml] [java] 23:57:57,219 INFO [SoapUITestCaseRunner] Running soapui tests in project [Sample Project] [java] 23:57:57,219 INFO [SoapUITestCaseRunner] Running soapui suite [Test Suite] [java] 23:57:57,219 INFO [SoapUITestCaseRunner] Running soapui testcase [Test Conversions] [java] 23:57:57,219 INFO [SoapUITestCaseRunner] runing step [SEK to USD Test] [java] Retrieving document at 'http://www.webservicex.net/CurrencyConvertor.asmx?WSDL'. [java] 23:57:59,893 INFO [SchemaUtils] Loading schema types from [http://www.webservicex.net/CurrencyConvertor.asmx?WSDL] [java] 23:57:59,893 INFO [SchemaUtils] loading schema types from http://www.webservicex.net/CurrencyConvertor.asmx?WSDL [java] Assertion [Schema Compliance] has status VALID [java] Assertion [XPath Match - check for less than 0.2] has status VALID [java] Assertion [XPath Match - check for more than 0.1] has status VALID [java] Assertion [SOAP Fault Assertion] has status VALID [java] 23:58:01,025 INFO [SoapUITestCaseRunner] runing step [USD to SEK Test] [java] Assertion [Schema Compliance] has status VALID [java] Assertion [XPath Match - check for less than 8] has status VALID [java] Assertion [XPath Match - check for more than 7] has status VALID [java] Assertion [SOAP Fault Assertion] has status VALID [java] 23:58:01,495 INFO [SoapUITestCaseRunner] Finished running soapui testcase [Test Conversions], time taken = 4276ms [java] 23:58:01,505 INFO [SoapUITestCaseRunner] Running soapui testcase [Test XMethods Query] [java] 23:58:01,505 INFO [SoapUITestCaseRunner] runing step [Test getAllServiceNames] [java] Assertion [XPath Match - check for Anagram Service] has status VALID [java] 23:58:03,488 INFO [SoapUITestCaseRunner] runing step [Transfer values] [java] 23:58:03,688 INFO [SoapUITestCaseRunner] runing step [Test getServiceDetail] [java] Assertion [XPath Match] has status VALID [java] 23:58:03,949 INFO [SoapUITestCaseRunner] Finished running soapui testcase [Test XMethods Query], time taken = 2444ms [java] 23:58:03,959 INFO [SoapUITestCaseRunner] soapui suite [Test Suite] finished in 6740ms BUILD SUCCESSFUL Total time: 10 seconds Finished at: Sun Oct 02 23:58:04 CEST 2005