Last active
June 13, 2018 11:54
-
-
Save shankybnl/074c66655cf75fa54dcde07bfccb6925 to your computer and use it in GitHub Desktop.
CucumberRunnerUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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