Maven SoapUI plugin - how to execute 2 SoapUI test projects during Maven's lifecycle

无人久伴 提交于 2019-12-04 19:52:01

You can specify multiple executions for SoapUI plugin. For example:

 <plugin>                                                                                                                      
     <groupId>eviware</groupId>                                                                                                
     <artifactId>maven-soapui-plugin</artifactId>                                                                              
     <version>3.6.1</version>                                                                                                  
     <configuration>                                      
         <outputFolder>${project.basedir}\src\test\resources\soapui\output</outputFolder>
         <junitReport>true</junitReport>
     </configuration>
     <executions>
         <execution>
             <id>soapUI1</id>
             <phase>test</phase>
             <goals>
                 <goal>test</goal>
             </goals>
            <configuration>
              <projectFile>${project.basedir}\src\test\resources\soapui\Web-Service-automatic-testing-soapui-project1.xml</projectFile> 
            </configuration>
         </execution>                                                                                                          
         <execution>
             <id>soapUI2</id>
             <phase>test</phase>
             <goals>
                 <goal>test</goal>
             </goals>
            <configuration>
              <projectFile>${project.basedir}\src\test\resources\soapui\Web-Service-automatic-testing-soapui-project2.xml</projectFile> 
            </configuration>
         </execution>                                                                                                          
     </executions>                                                                                                             
 </plugin>

You can use this plugin for above requirement. Given below is a code block for it.

<build>
        <plugins>
            <plugin>
                <groupId>com.github.redfish4ktc.soapui</groupId>
                <artifactId>maven-soapui-extension-plugin</artifactId>
                <version>4.6.4.1</version>
                <executions>
                    <execution>
                        <id>soapUI1</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test-multi</goal>
                        </goals>
                        <configuration>
                            <projectFiles>
                                <scan>
                                    <baseDirectory>/home/waruna/workspace/soapuitest/src/main/resources/projects</baseDirectory>
                                    <includes>
                                        <include>*.xml</include>
                                    </includes>
                                    <excludes>
                                        <exclude>**/*fail-*-soapui-project.xml</exclude>
                                        <exclude>**/composite-projects/**</exclude>
                                    </excludes>
                                </scan>
                            </projectFiles>
                            <outputFolder>/home/waruna/workspace/soapuitest/src/main/resources/</outputFolder>
                            <junitReport>true</junitReport>
                            <useOutputFolderPerProject>true</useOutputFolderPerProject>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

Don't go the maven route. use command line testrunner.sh and run all the tests in a for loop.

Running soapui composite project from junit test

Only major issue for running SOAPUI project from junit tests is finding all correct dependency jars of SOAPUI.

I have created an uber jar of all required jars. This new jar is added below on GitHub code base in lib folder. This uber jar is compatible with Ready API 1.5.0 version. (Note that, I have tried it with rest API testing with composite project)

Junit test case takes composite project path and runs all test steps from each test case.

Running tests at step level helps to debug if build fails.

http://www.learnteachandlearn.com/2015/12/executing-composite-soapui-project-from.html

https://github.com/suyogchoudhari/soapui-junit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!