2012-03-28 64 views
1

我有兩個不同的SoapUI測試項目,我想在構建過程中運行(我正在使用maven-soapui-plugin 3.6.1和Maven 3) 。 目前我所能做的只是執行一個項目(參見我的pom.xml文件)......假設我想執行2個SoapUI測試項目並控制它們的執行順序...... 這樣做的正確語法是什麼?Maven SoapUI插件 - 如何在Maven生命週期中執行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> 
+0

我經歷了同樣的事情不是很久以前,我的問題和解決方案可以在這裏找到。一個重要的說明,我正在處理300 +服務。 http://stackoverflow.com/questions/9184862/soapui-maven-plugin-executing-multiple-projects/9245939#9245939 – 2012-04-03 15:41:01

回答

6

您可以指定了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> 
+0

感謝那一個 - 我會嘗試它。他們將按什麼順序執行? – 2012-03-28 14:25:17

+0

按照您聲明的順序。還要確保他們有唯一的執行ID。 – 2012-03-28 14:26:20

+0

謝謝。我已經做出了改變,明天早上(在夜間建立之後),我會看看它是如何工作的。 – 2012-03-28 14:59:55

0

不要去maven路線。使用命令行testrunner.sh並在for循環中運行所有測試。

1

您可以使用this插件以滿足上述要求。下面給出的是它的代碼塊。從JUnit測試

從JUnit測試運行SOAPUI項目只有重大問題

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

運行的soapUI複合項目是找到SOAPUI的正確的依賴罐子。

我創建了一個所有需要的罐子的超級罐子。這個新的jar被添加到lib文件夾中的GitHub代碼庫中。這個超級罐子與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