简体   繁体   English

Jenkins中的故障安全html报告

[英]Failsafe html reports in Jenkins

I have some integration tests (with Selenium) which are run with failsafe maven plugin. 我有一些与故障安全maven插件一起运行的集成测试(使用Selenium)。 Failsafe generates XML reports files only. Failsafe仅生成XML报告文件。

1) I want to generate HTML reports 1)我想生成HTML报告

2) I want to have a link in Jenkins to the html reports 2)我想在Jenkins中有一个关于html报告的链接

For the 1) I installed the "maven-surefire-report-plugin" to use the failsafe-report-only goal. 对于1)我安装了“maven-surefire-report-plugin”来使用failafe-report-only目标。

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

But in the standard output, nothing seems to be generated : 但在标准输出中,似乎没有生成任何内容:

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

In my failsafe-reports directory, I have only XML report files but not the HTML ones. 在我的failsafe-reports目录中,我只有XML报告文件,但没有HTML报告文件。

Is it the good plugin to generate html reports for failsafe? 它是为故障安全生成html报告的好插件吗?

For the 2), I installed the Jenkins plugin "Selenium HTML report" and added the post build action "Publish Selenium HTML report" and configured it with "target/failsafe-reports" value for "Selenium tests results location" parameter, but nothing is displayed in Jenkins interface (surely because my html reports file are not generated...). 对于2),我安装了Jenkins插件“Selenium HTML报告”,并添加了帖子构建操作“Publish Selenium HTML report”,并为“Selenium tests results location”参数配置了“target / failsafe-reports”值,但没有在Jenkins界面中显示(当然因为我的html报告文件没有生成...)。

Could you help me for these 2 points? 这两点可以帮助我吗?

Answer for the part 1) to generate HTML reports for Failsafe. 回答第1部分为Failsafe生成HTML报告。

Add the following to pom.xml 将以下内容添加到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>

I am assuming you are using mvn verify to run the integration tests using failsafe-plugin. 我假设你使用mvn验证使用failsafe-plugin运行集成测试。 By default, this generates the ( *.txt & *.xml ) reports in {basedir}/target/failsafe-reports. 默认情况下,这会在{basedir} / target / failsafe-reports中生成( *.txt*.xml )报告。 This should be specified in <reportDirectories> . 这应该在<reportDirectories>指定。 You can point to any directory which has TEST-*.xml reports. 您可以指向任何具有TEST - *。xml报告的目录。

And then run the cmd 然后运行cmd

mvn site

This would generate html reports for the Failsafe run integration tests. 这将为Failsafe运行集成测试生成html报告。 By default, The files would be in {basedir}/target/site/failsafe-report.html. 默认情况下,文件位于{basedir} /target/site/failsafe-report.html。 This location be changed. 这个位置可以改变。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM