Ad

Monday, May 9, 2011

Integrating soap ui maven plugin

What a pleasure, a way to integrate your soap ui project into a maven build :)

Just pop this into your pom.xml from where your web module is located; this will start/stop jetty for the soap ui plugin to invoke its tests:


<plugin>
               <groupId>org.mortbay.jetty</groupId>
               <artifactId>maven-jetty-plugin</artifactId>
               <version>6.1.21</version>
               <configuration>
                   <stopKey>foo</stopKey>
                   <stopPort>9999</stopPort>
                   <webAppConfig>
                       <contextPath>/test</contextPath>
                   </webAppConfig>
               </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>




And insert the soap ui plugin to invoke on inegration-test phase pointing to a valid soap ui project XML:

<plugin>
                <groupId>eviware</groupId>
                <artifactId>maven-soapui-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <projectFile>${project.basedir}/soapui-project.xml
                    </projectFile>
                    <outputFolder>${project.basedir}/target/test/soapui-results</outputFolder>
                    <junitReport>true</junitReport>
                </configuration>
                <executions>
                    <execution>
                        <id>soapUI</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

No comments: