2013-02-27 78 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中。 这个位置被改变。