This article extends the basic example described in "Web service testing with soapUI". It describes how to integrate soapUI tests in maven build lifecycle, using maven-jetty-plugin to run the web application and maven-soapui-plugin to run the tests.
That is how it goes:
- in the pre-integration-test phase : starts our web application in jetty
- in the integration-test phase : runs soapUI tests
- in the post-integration-test phase : stops jetty
1. How to configure the jetty plugin
This makes the web application available under http://localhost:8080/trip-price-0.0.1-SNAPSHOT/webservices/TripPriceService
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test.webservice.soapui.example</groupId>
<artifactId>trip-price-war</artifactId>
<packaging>war</packaging>
<name>trip-price-war</name>
<version>0.0.1-SNAPSHOT</version>
<build>
<finalName>trip-price-${version}</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.21</version>
<configuration>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<contextPath>/trip-price-${version}</contextPath>
<webApp>target/trip-price-${version}.war</webApp>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
...
</build>
...
</project>
2. How to configure the soapUI plugin
Add the following content under the plugins tag.
<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>3.0</version>
<configuration>
<projectFile>${basedir}/src/test/resources/trip-price-service-soapui-project.xml</projectFile>
<printReport>true</printReport>
</configuration>
<executions>
<execution>
<id>soap-integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
You may need to add the following repository.
<pluginRepository>
<id>eviwarePluginRepository</id>
<url>http://www.eviware.com/repository/maven2/</url>
</pluginRepository>
3. How to run the tests
This will run the tests before installing.
mvn install
Related topics:
"Web service testing with soapUI""Web service testing with soapUI: exceptions"

Hi Nadege,
thanks a lot for this post. I'm currently trying to test ws client using a soapui Mock. Do you have successfully used maven soapui mock plugin ?
Thanks & Regards,
David.