title: Rerunning failed cucumber tests using cucumber-jvm
body: <p>I have a Cucumber-JVM, JUnit, Selenium setup. I initiate the run by running <code>RunSmokeTests.java</code> using JUnit within Eclipse. I have also set up a maven profile to run the tests from command line, and possibly Jenkins in the future.</p>
  
  <p>When the tests are run then some of them may fail sometimes, mainly due to the application taking longer than expected. I would then have to re-run these scenarios. At the moment I run them by manually attaching <code>@rerun</code> tag to the ones that failed and then running <code>RunReruns.java</code>, which is similar to <code>RunSmokeTest.java</code> but with <code>@rerun</code> tag.</p>
  
  <p>With the increasing number of automated tests it is time consuming to tag the tests and start the run and clear the tags. Is there a automated way with Cucumber-JVM to re-run failed tests?</p>
  
  <p><strong>RunSmokeTests.java</strong></p>
  
  <pre><code>package testGlueClasses;
  import cucumber.api.junit.Cucumber;
  import org.junit.runner.RunWith;
  
  @RunWith(Cucumber.class)
  @Cucumber.Options(features = "src/test/java", strict = true, format = {
          "html:target/CucumberReport", "json:target/JSON/Cucumber.json",
          "FrameworkCore.CustomTestReporter" }, tags = { "@SmokeTest" }, glue = {
          "FrameworkCore", "MyApp.Utils", "MyApp.StepDefinitions" })
  public class RunSmokeTests {
  
  } 
  </code></pre>
  
  <p><strong>Maven snippet:</strong>
         </p>
  
  <pre><code>    &lt;profile&gt;
          &lt;id&gt;smoke&lt;/id&gt;
          &lt;properties&gt;
              &lt;include.tests&gt;
                  **/RunSmokeTests.java
              &lt;/include.tests&gt;
          &lt;/properties&gt;
      &lt;/profile&gt;
  </code></pre>