使用 Jenkins 显示自定义 HTML 或 XML 报告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28085207/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 12:06:31  来源:igfitidea点击:

Displaying custom HTML or XML reports with Jenkins

xmljenkins

提问by PrathamN

I have generated custom XML reports through testing. is it possible to display these XML with Jenkins? If possible, then how to display it with Jenkins?

我通过测试生成了自定义 XML 报告。是否可以使用 Jenkins 显示这些 XML?如果可能,那么如何用Jenkins展示它?

回答by Joachim Nilsson

If it is a homebrewed XML, I would suggest that you first convert it to HTML then use the HTML Publisher Plugin

如果是自制的 XML,我建议您先将其转换为 HTML,然后使用 HTML Publisher Plugin

https://wiki.jenkins-ci.org/display/JENKINS/HTML+Publisher+Plugin

https://wiki.jenkins-ci.org/display/JENKINS/HTML+Publisher+Plugin

Otherwise, mark it as a build artifact and allow users to download it from the Jenkins job.

否则,将其标记为构建工件并允许用户从 Jenkins 作业下载它。

回答by Eyal Sooliman

First you have to:

首先你必须:

  1. Configure listeners in your testNg.xml file.
  2. Write the listeners classes.
  1. 在 testNg.xml 文件中配置侦听器。
  2. 编写监听器类。

Then, configure Jenkins to show the custom report after your builds:

然后,配置 Jenkins 以在构建后显示自定义报告:

  1. Go to "Post-build Actions" -> Choose "publish html reports".
  2. Add your directory where the custom report is, for example: /test-output
  3. Add the index file under Index page[s], for example: custom-report.html
  1. 转到“构建后操作”-> 选择“发布 html 报告”。
  2. 添加自定义报告所在的目录,例如:/test-output
  3. 在Index page[s]下添加index文件,例如:custom-report.html

Run your build an see your custom html report on Jenkins.

运行您的构建并在 Jenkins 上查看您的自定义 html 报告。

回答by QA Automation tester

Install HTMLPublisher plugin in Jenkins and after that perform the steps mentioned by Eyal

在 Jenkins 中安装 HTMLPublisher 插件,然后执行 Eyal 提到的步骤

回答by Fakrudeen