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.
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.
From the official documentation:
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.
So you can configure your Maven build execution on Jenkins using the option:
-Dsurefire.rerunFailingTestsCount=2
Just note from official documentation that:
NOTE : This feature is supported only for JUnit 4.x.