cucumber / cucumber-jvm

Cucumber for the JVM
https://cucumber.io
MIT License
2.7k stars 2.02k forks source link

When using 'cucumber-junit-platform-engine' rerun files are not supported. How to rerun failed cases ? #2843

Closed gorakshasabnis closed 9 months ago

gorakshasabnis commented 9 months ago

In JUnit 4 failure cases were captured using 'rerun' like below:

@RunWith(Cucumber.class)
@CucumberOptions(
        plugin = {"pretty", "rerun:target/failed-scenarios/FailedCases.txt"},
        features = "src/test/resources/features"
)
public class TestRunner {}

Which can be run using below Junit4 runner


@RunWith(Cucumber.class)
@CucumberOptions(
            plugin = {"pretty"},
            features = "@target/failed-scenarios/FailedCases.txt"
)
public class TestReRunner {}

Q: However in JUnit5, 'FailedCases.txt' gets generated by mentioning rerun in 'PLUGIN_PROPERTY_NAME'. File gets generated too, but there is no way to execute that file.

Can someone please guide for re-running failed cases using Cucumber JUnit5 ?

mpkorstanje commented 9 months ago

Duplicate of https://github.com/cucumber/cucumber-jvm/issues/2805

gorakshasabnis commented 9 months ago

@mpkorstanje is there is any different documention on how exactly to run this class along with '@ suite' ?

mpkorstanje commented 9 months ago

For Maven you could use the exec Maven plugin and bind it to the test phase. You would not use the suite in this case, you're programatically running JUnit.

https://www.mojohaus.org/exec-maven-plugin/