Open emaks opened 12 months ago
is there any way to rerun failed tests with junit5?
To rerun failed scenarios please review https://github.com/cucumber/cucumber-jvm/tree/main/cucumber-junit-platform-engine#rerunning-failed-scenarios.
While it would be possible to implement a JUnit Engine that executes rerun.txt
files, the JUnit 5 Platform does not support ordering test engines. So there is no guarantee that such a cucumber-rerun
engine will be invoked after the cucumber
engine.
Additionally JUnit 5 somewhat implicitly expects that test execution does not change the tests that could be discovered. While it may be possible with the current state of Surefire and Gradle to ignore that, it could cause all sorts of janky behavior when the JUnit API is used as intended.
More jank than I'm willing to accommodate for.
If this is a major impediment to you, I reckon that you or your company can either petition Gradle and/or Surefire for better JUnit 5 support or materially contribute to that support in some way.
Alternatively, if some one is able to convince the JUnit 5 team to accept a PR that makes it possible order test engines and and willing to commit to dealing with all the jank that comes from implementing cucumber-rerun
, I would be willing to accept a PR for that too.
Additionally JUnit 5 somewhat implicitly expects that test execution does not change the tests that could be discovered.
Potentially implementing TestDescriptor.mayRegisterTests
on the rerun engines test descriptor could solve this.
That does leave the test engine ordering problem.
That does leave the test engine ordering problem.
And the ordering problem could be solved by having multiple surefire executions. One for the run and a second for the rerun. Each targeting different suites. Still janky, but better than nothing.
I use cucumber with gradle and run tests with next configuration in build.gradle
Everting work fine when I just run tests. But if I get "build/site/failed_scenarios.txt" file with failed tests and try to rerun only failed tests with
systemProperty("cucumber.features", "@build/site/failed_scenarios.txt")
I get an errorwith junit4 I used