Forum Discussion

zaheer2308's avatar
zaheer2308
Visitor
2 years ago

Rerun failed test from mvn command line.

Hi All,

This is what I am search from last 2 weeks and none of the solution on internet worked for me. 

 

I have junit+selenium+cucumber project. for that I have 2 class (testrunner.java and failedrun.java) for test runs. Upon running tests, rerun.txt file generates under 'target' folder which is expected. Now, I want to have command to execute only rerun.txt or cases listed under this file. I have tried options like 

mvn clean verify  -Dcucumber.options="@target/rerun.txt"

but these doesn't work, If I use this it automatically runs all the tests from all the available feature files. 

 

to give better perspective, here is my runner class:

@RunWith(Cucumber.clas
@CucumberOptions(
features = {"src/test/resources/com/brillio/feature/"},
glue = {"com/brillio/stepdefinition", "com/brillio/apphooks"},
tags = "",
plugin = {"pretty","com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:", "rerun:target/rerun.txt"}

)
public class TestRunner {


}

 

here is my failedrun class

 

@RunWith(Cucumber.class)

@CucumberOptions(
//features = {"src/test/resources/AppFeatures/AccountsPage.feature"},
features = {"@target/rerun.txt"},
glue = {"com/brillio/stepDefination", "com/brillio/appHooks"},
plugin = {"pretty","com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:",
"rerun:target/rerun.txt",

}

)
/*

@CucumberOptions(plugin={"rerun:failedrerun.txt", "com.trulia.infra.WebDriverInitFormatter",
"json:target/cucumber.json","html:target/cucumber"})
*/

public class FailedRun {

}

 

Thanks in advance.

No RepliesBe the first to reply