Retry failed feature file

573 views Asked by At

Background
We are able to run .feature files in parallel, using teymyers Cucumber Parallel plugin. This creates a java file for each .feature file, for example, Parallel01IT.java, Parallel02IT.java ... ...

Question: How can run I re-run/retry these ParallexxIT.java files if fails?

There is nothing that comes to me that I can try. I could found few links in SO for Karate Cucumber, Ruby Cucumber but not on Serenity Cucumber.

1

There are 1 answers

0
Motivated Mind On
  1. While fresh run pass rerun plugin as an argument "-p", "rerun:target/cucumber/rerun.txt". This will generate cucumber rerun file which has line numbers of failed scenarios.
  2. Then next time instead of features directory pass rerun text file "@target/cucumber-reports/rerun.txt"
  3. This will re-run only your failed scenarios

If you are using cucumber options [I am not sure but I guess this was planned for deprecation] via junit runner then do as below.

Fresh run :

@CucumberOptions(features = {"src/test/resources/"},
    plugin = {"pretty", "json:target/cucumber/cucumber.json",
        "rerun:target/cucumber-reports/rerun.txt"})

Rerun :

        @CucumberOptions(
            features = {"@target/cucumber/rerun.txt"},
            plugin = {"pretty", rerun:target/cucumber/rerun.txt"})