2013-02-27 62 views
6

我有一些集成測試(使用Selenium),它們與故障安全的maven插件一起運行。故障安全僅生成XML報告文件。Jenkins故障安全html報告

1)我想生成HTML報告

2)我想在詹金斯的HTML報告

爲1的鏈接)我安裝的是「Maven的萬無一失報告,插件」使用故障安全報告目標。

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-report-plugin</artifactId> 
    <version>2.13</version> 
    <executions> 
    <execution> 
     <phase>post-integration-test</phase> 
     <goals> 
     <goal>failsafe-report-only</goal> 
     </goals> 
    </execution> 
    </executions> 
</plugin> 

但在標準輸出,似乎沒有任何可以產生:

[INFO] 
[INFO] >>> maven-surefire-report-plugin:2.13:failsafe-report-only (default) @ BaseContrats >>> 
[INFO] 
[INFO] <<< maven-surefire-report-plugin:2.13:failsafe-report-only (default) @ BaseContrats <<< 
[INFO] 
[INFO] --- maven-surefire-report-plugin:2.13:failsafe-report-only (default) @ BaseContrats --- 

在我的故障安全的報告目錄,我只有XML報告文件而不是HTML的。

它是生成故障安全報告的好插件嗎?

對於2),我安裝了Jenkins插件「Selenium HTML report」,並添加了後期製作操作「Publish Selenium HTML report」,並使用「Selenium tests results location」的「target/failsafe-reports」參數,但沒有任何顯示在Jenkins界面(當然,因爲我的HTML報告文件沒有生成...)。

你能幫我解決這兩點嗎?

+0

我覺得Maven的「網站」插件會生成你想要的HTML報告,對不對?無論是我還是我知道,只要您設置Junit插件篩選器以將測試輸出文件定位在正確的位置,jenkins就可以執行此操作。 – djangofan 2015-06-18 22:29:53

回答

5

回答部分1)爲Failsafe生成HTML報告。

添加以下的pom.xml

<reporting> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-report-plugin</artifactId> 
      <version>2.18.1</version> 
      <configuration> 
       <skipSurefireReport>${skipSurefireReport}</skipSurefireReport> 
       <reportsDirectories> 
        <reportsDirectory>${basedir}/target/failsafe-reports</reportsDirectory> 
       </reportsDirectories> 
      </configuration> 
     </plugin> 
    </plugins> 
</reporting> 
<properties> 
    <skipSurefireReport>true</skipSurefireReport> 
</properties> 

我假設你正在使用MVN驗證運行使用故障保護,插件集成測試。默認情況下,這將在{basedir}/target/failsafe-reports中生成(*.txt & *.xml)報告。這應該在<reportDirectories>中指定。您可以指向任何具有TEST - *。xml報告的目錄。

然後運行cmd中

mvn site 

這將產生故障安全運行集成測試的HTML報告。默認情況下,這些文件位於{basedir} /target/site/failsafe-report.html中。 這個位置被改變。