使Jenkins自动运行失败的测试 [英] Make Jenkins run failed test automatically
问题描述
我找到了 Flaky Test Handler
的插件, c1>,此插件可以运行现场测试,但不能由调度程序自动运行.该Flaky Test Handler
具有提供按钮DeFlake Build
,但是我必须自己单击它.
I found plugin Flaky Test Handler
for Jenkins
, this plugin can run field tests, but not automatically by scheduler. This Flaky Test Handler
has provide button DeFlake Build
, but I have to click it by myself.
问题:我可以通过按钮或其他任何建议来解决此问题吗?
Question: Can I make workaround on the button or any other suggestions?
目标是:自动再次运行失败的测试.
Goal is: Run failed tests again automatically.
推荐答案
您不需要Jenkins插件,可以使用 /examples/rerun-failing-tests.html"rel =" nofollow>自动重新运行失败的测试,因此是您Maven构建的一部分.
You don't need a Jenkins plugin for that, you can use out-of-the-box features of the Maven Surefire Plugin for re-run failed tests automatically, hence as part of your Maven build.
来自官方文档 :
在开发过程中,您可能会重新运行失败的测试,因为它们是不稳定的.要通过Maven surefire使用此功能,请将rerunFailingTestsCount属性设置为大于0的值.测试将一直运行,直到通过,或耗尽了重新运行的次数.
During development, you may re-run failing tests because they are flaky. To use this feature through Maven surefire, set the rerunFailingTestsCount property to be a value larger than 0. Tests will be run until they pass or the number of reruns has been exhausted.
因此,您可以使用以下选项在Jenkins上配置Maven构建执行:
So you can configure your Maven build execution on Jenkins using the option:
-Dsurefire.rerunFailingTestsCount=2
只需从官方文档中注意到:
Just note from official documentation that:
注意:仅JUnit 4.x支持此功能.
NOTE : This feature is supported only for JUnit 4.x.
这篇关于使Jenkins自动运行失败的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!