Cannot inject @Test annotated Method [feature] with [interface cucumber.api.testng.CucumberFeatureWrapper].
For more information on native dependency injection please refer to http://testng.org/doc/documentation-main.html#nativ
e-dependency-injection
I know that @Test method can only have @ITestContext annotation. How to run my feature file?
I using version 2.4.0 for cucumber-jvm. Any concrete examples?
@CucumberOptions(
features = "src/Feature",
glue = {"Step_Definitions"},
plugin = {
"pretty",
"html:target/cucumber-reports/cucumber-pretty",
"json:target/cucumber-reports/CucumberTestReport.json",
"rerun:target/cucumber-reports/rerun.txt"
})
public class TestRunner {
private TestNGCucumberRunner testNGCucumberRunner;
private ExtentReportManager reportMgr;
private PropertiesManager pm;
@BeforeTest(alwaysRun = true)
public void setUp() throws Exception {
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
pm = PropertiesManager.createInstance();
reportMgr = ExtentReportManager.createInstance();
WebDriverManager.createDriver();
}
@Test(groups = "cucumber", description = "Runs Cucumber Feature"/*, dataProvider = "dataProvider"*/)
public void feature(CucumberFeatureWrapper cucumberFeature) {
//ITestContext context
testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
}
/*@DataProvider(name = "dataProvider", parallel = true)
public Object[][] features() {
return testNGCucumberRunner.provideFeatures();
}*/
@AfterTest(alwaysRun = true)
public void tearDown() throws Exception {
reportMgr.getExtent().flush();
testNGCucumberRunner.finish();
}
Please help. Thanks.