junit-plugin icon indicating copy to clipboard operation
junit-plugin copied to clipboard

Support <flakyFailure> and <flakyError> in junit xml report

Open ijuma opened this issue 4 years ago • 2 comments

Both Maven and Gradle support automatically re-running tests on failure and marking them as flaky if they pass on the retry. For better or worse, flaky tests are a common problem for integration and system tests. Marking such tests as flaky would be very helpful.

The Flaky Test Handler plugin has this functionality and more, but it was last released 5 years ago and not actively maintained. It would be great if the basic reporting functionality was part of the core junit plugin.

Relevant documentation for Maven surefire:

flakyFailure and flakyError elements will be used in the generated xml report to include information of each failing re-runs. https://maven.apache.org/surefire/maven-surefire-plugin/examples/rerun-failing-tests.html

Similarly, Gradle:

When mergeReruns is enabled, if a test fails but is then retried and succeeds, its failures will be recorded as <flakyFailure> instead of <failure>, within one <testcase> https://docs.gradle.org/6.8/userguide/java_testing.html#mergereruns

ijuma avatar Jan 17 '21 19:01 ijuma

Contributions welcome...

timja avatar Jan 17 '21 19:01 timja

Looks like flaky-test-handler had a new release recently https://plugins.jenkins.io/flaky-test-handler/#releases

ijuma avatar Mar 29 '21 13:03 ijuma