本文介绍了如何编写Jenkins email-ext模板以显示测试结果(如标准测试报告)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经对标准的果冻模板进行了调整,以在表格中显示当前的测试结果,但是我真的希望能够显示差异,就像在詹金斯自己的测试结果页面中看到的那样.

例如:

JUnit Tests: 0 failures (±0) , 1 skipped (+1)

Package               Duration   Fail  (diff)  Skip  (diff)  Total  (diff)
foo.bar.baz              89 ms      0      0     1       +1     5       +2
解决方案

为Email Ext插件而不是Jelly模板编写Groovy模板.在Groovy模板中,您可以访问用于构建的 Build 对象.然后,您可以对其调用 getTestResultAction 以获得AbstractTestResultAction 用于构建,然后您可以查询所需的一切.

此处是 Jenkins主模块API 的链接.在$JENKINS_HOME/plugins/email-ext/WEB-INF/classes/hudson/plugins/emailext/templates/groovy-html.template中可以找到用于Ext Email插件的示例Groovy模板.有关Groovy模板/脚本用法的更多信息,请参见 Email Ext插件文档./p>

I have tweaked the standard jelly template to display the current test results in a table, however I really want to be able to display diffs as seen in Jenkins own test results page.

For example:

JUnit Tests: 0 failures (±0) , 1 skipped (+1)

Package               Duration   Fail  (diff)  Skip  (diff)  Total  (diff)
foo.bar.baz              89 ms      0      0     1       +1     5       +2
解决方案

Write a Groovy template for Email Ext plugin instead of Jelly template. In Groovy template you'll have access to Build object for your build. You can then call getTestResultAction on it to obtain the AbstractTestResultAction for the build which you can then query for everything you need.

Here is a link to Jenkins Main Module API. A sample Groovy template for Ext Email plugin could be found in $JENKINS_HOME/plugins/email-ext/WEB-INF/classes/hudson/plugins/emailext/templates/groovy-html.template. More info on Groovy template/script usage can be found in Email Ext plugin documentation.

这篇关于如何编写Jenkins email-ext模板以显示测试结果(如标准测试报告)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 02:30