Maven SoapUI插件 - 如何在Maven的生命周期中执行2个SoapUI测试项目

时间:2012-03-28 12:35:59

标签: unit-testing maven-3 soapui pom.xml

我有两个不同的SoapUI测试项目,我想在构建期间运行(我正在使用maven-soapui-plugin 3.6.1和Maven 3)。 目前我所能做的只是执行一个项目(参见我的pom.xml文件)...假设我想执行2个SoapUI测试项目并控制它们的执行顺序...... 这样做的正确语法是什么?

我当前的pom.xml文件:

 <plugin>                                                                                                                      
     <groupId>eviware</groupId>                                                                                                
     <artifactId>maven-soapui-plugin</artifactId>                                                                              
     <version>3.6.1</version>                                                                                                  
     <configuration>                                                                                                           
      <projectFile>${project.basedir}\src\test\resources\soapui\Web-Service-automatic-testing-soapui-project.xml</projectFile> 
         <outputFolder>${project.basedir}\src\test\resources\soapui\output</outputFolder>                                      
         <junitReport>true</junitReport>                                                                                       
     </configuration>                                                                                                          
     <executions>                                                                                                              
         <execution>                                                                                                           
             <id>soapUI</id>                                                                                                   
             <!--Run as part of the test phase in the Maven lifecycle-->                                                       
             <phase>test</phase>                                                                                               
             <goals>                                                                                                           
                 <goal>test</goal>                                                                                             
             </goals>                                                                                                          
         </execution>                                                                                                          
     </executions>                                                                                                             
 </plugin>

4 个答案:

答案 0 :(得分:7)

您可以为SoapUI插件指定多个执行。例如:

 <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>

答案 1 :(得分:1)

您可以使用this插件满足上述要求。下面给出了它的代码块。

<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>

答案 2 :(得分:0)

不要走maven路线。使用命令行testrunner.sh并在for循环中运行所有测试。

答案 3 :(得分:0)

从junit test

运行soapui复合项目

从junit测试运行SOAPUI项目的唯一主要问题是找到所有正确的SOAPUI依赖项jar。

我创造了一个所有必需​​罐子的超级罐子。下面在lib文件夹中的GitHub代码库中添加了这个新jar。这个超级jar与Ready API 1.5.0版本兼容。 (请注意,我已尝试使用复合项目的其余API测试)

Junit测试用例采用复合项目路径并运行每个测试用例的所有测试步骤。

在步骤级别运行测试有助于在构建失败时进行调试。

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

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