Maven SoapUI plugin - how to execute 2 SoapUI test

2019-04-16 09:58发布

I have 2 different SoapUI test projects that I want to run during the build (I am using maven-soapui-plugin 3.6.1 and Maven 3 for that). Currently all I can do is to execute only 1 project (see my pom.xml file)... Suppose I want to execute 2 SoapUI test projects and also control their execution order... What is the correct syntax to do so ?

My current pom.xml file :

 <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条回答
ゆ 、 Hurt°
2楼-- · 2019-04-16 10:16

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>
查看更多
叼着烟拽天下
3楼-- · 2019-04-16 10:23

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

查看更多
我命由我不由天
4楼-- · 2019-04-16 10:26

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

查看更多
一夜七次
5楼-- · 2019-04-16 10:29

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>
查看更多
登录 后发表回答