Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CucumberRunnerUtil.java
@RunWith(Cucumber.class)
@CucumberOptions(
monochrome = true,
features = "src/test/java/features",
glue = {"utils","steps"},
tags = {"@single"},
format = {
"pretty",
"html:target/cucumber-reports/cucumber-pretty",
"json:target/cucumber-reports/CucumberTestReport.json",
"rerun:target/cucumber-reports/rerun.txt"}
)
public class CucumberRunnerUtil {
private TestNGCucumberRunner testNGCucumberRunner;
@BeforeSuite
@org.testng.annotations.Parameters("environment")
public void setUpEnvironment(String environment){
CommonUtil.environmentSetUp(environment);
CommonUtil.initialSetUp();
}
@BeforeClass(alwaysRun = true)
public void setUpClass() throws Exception {
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
}
@Test(groups = "cucumber", description = "Runs Cucumber Feature",dataProvider = "features" )
public void feature(CucumberFeatureWrapper cucumberFeature) {
testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
}
@DataProvider
public Object[][] features() {
return testNGCucumberRunner.provideFeatures();
}
@AfterClass(alwaysRun = true)
public void tearDownClass() throws Exception {
testNGCucumberRunner.finish();
}
@AfterSuite
public void cleanUp(){
CrudOperations.closeSessionFactory();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.