2017-05-07 111 views
0

我想使用maven,surefire和jenkins運行SoapUI xml項目文件。 所有的maven和jenkins都很好,在構建完成後,jenkins中顯示Junit報告(帶有非常基本的信息 - 測試用例名稱和狀態)SoapUI,Maven,Surefire和Jenkins集成

我想用surefire來顯示報告和日誌目標/ surfire-report/all * .xml和* .txt作爲日誌文件)。 如何配置jenkins以顯示surefire報告和日誌文件?

這裏是我的pom.xml文件

<pluginRepositories> 
    <pluginRepository> 
     <id>smartbear-sweden-plugin-repository</id> 
     <url>http://www.soapui.org/repository/maven2/</url> 
    </pluginRepository> 
</pluginRepositories> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>com.smartbear.soapui</groupId> 
      <artifactId>soapui-maven-plugin</artifactId> 
      <version>5.3.0</version> 
      <configuration> 
       <projectFile>${basedir}/src/test/java/Test-API-soapui-project.xml</projectFile> 
       <outputFolder>${basedir}/target/surefire-reports/</outputFolder> 
       <junitReport>true</junitReport> 
       <exportwAll>true</exportwAll> 
       <printReport>true</printReport> 
      </configuration> 
      <executions> 
       <execution> 
        <id>soapUI</id> 
        <phase>integration-test</phase> 
        <goals> 
         <goal>test</goal> 
        </goals> 
       </execution> 
      </executions> 
      <dependencies> 
       <dependency> 
        <groupId>com.smartbear.soapui</groupId> 
        <artifactId>soapui</artifactId> 
        <version>5.3.0</version> 
        <exclusions> 
         <exclusion> 
          <groupId>javafx</groupId> 
          <artifactId>jfxrt</artifactId> 
         </exclusion> 
        </exclusions> 
       </dependency> 
      </dependencies> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-report-plugin</artifactId> 
      <version>2.20</version> 
     </plugin> 
    </plugins> 
</build> 

回答

1

不知道,如果你得到了這個固定的,但是這是我做到了。

在Jenkins爲您的項目構建添加發布junit測試報告結果的構建後操作。 設置測試報告XML指向您的目標/ surefire-reports目錄,您在其中看到要編寫的報告。 在下面的示例中,我正在config目錄中存在的子模塊「dev」中運行測試。 你會知道什麼時候它是正確的,因爲如果詹金斯找不到報告xmls,它會顯示一個紅色的錯誤信息,並沒有發現報告xmls,你已經告訴他們他們會。

希望這會有所幫助。

enter image description here