Jenkins和JUnit [英] Jenkins and JUnit

查看:820
本文介绍了Jenkins和JUnit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经读过Jenkins网站和它的JUnit插件,由于某种原因,一些非常基本的东西对我来说是不明显的。

I've read over the Jenkins site and its JUnit plugin, and for some reason something that is very basic is just not apparent to me.

Jenkins有一个 Email-ext 插件,用于在运行构建时发送自定义/高级通知电子邮件。在这些电子邮件中,您可以放置​​作为运行时变量的内容令牌,以便在生成电子邮件时替换为动态值。

Jenkins has an Email-ext plugin for sending custom/advanced notification emails whenever a build is ran. In these emails you can place "content tokens" that are runtime variables that get replaced with dynamic values when the email is being generated.

的这些标记是 TEST_COUNTS ,它允许您显示运行或失败的JUnit测试的数量等。

One of these tokens is TEST_COUNTS which allows you to display the number of JUnit tests that ran, or which failed, etc.

如何让Jenkins正确显示这些信息?是否有一个插件我需要,如果是,哪一个?我有我的构建运行JUnit并生成一个XML报告。我假设Jenkins以某种方式解析该XML中的JUnit结果,并使用它为该标记赋予值。

How does one go about getting Jenkins to display this information correctly? Is there a plugin I need, and if so, which one? I have my build running JUnit and generating an XML report. I assume Jenkins somehow parses JUnit results out of that XML and uses it to give values to that token.

但是另一方面,我读过邮件列表帖子)似乎建议,为了使用该令牌,您需要使用Jenkins运行单元测试,而不是从您的构建脚本内的 junit Ant任务。

But on the other hand, I've read "literature" (mailing list posts) that seems to suggest that in order to use that token you need to use Jenkins to run the unit tests, not a junit Ant task from inside your build script.

有人可以为我澄清这一点,甚至可以列出操作顺序,我需要采取什么步骤才能使用这个令牌?

Can someone clarify this for me and perhaps even set out the "order of operations" for what steps I need to take in order to be able to make use of this token?

在我们的构建通知中获取测试计数是非常有用的。

It would be supremely useful to get test counts in our build notifications.

推荐答案

您的第一个解释是正确的。你告诉Jenkins在哪里搜索JUnit输出文件,并解析它们以找出测试结果:

Your first explanation is right. You tell Jenkins where to search for JUnit output files, and it parses them to find out the test results:

测试结果显示在每个项目和构建页面上,您会看到正确的结果,您应该在电子邮件中获得正确的令牌替换

The test results appear on each project and build page, so as long as you're seeing the correct results there, you should get the correct token replacements in your e-mails

这篇关于Jenkins和JUnit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆