public class TestRunner extends BaseTest{
static LoginPage loginPage = new LoginPage();
private TestNGCucumberRunner testNGCucumberRunner;
public static RemoteWebDriver connection;
public ExtentTest test;
@BeforeClass(alwaysRun = true)
public void setUpClass(){
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
}
Current implementation:
Desired version:
below is my TestNGRunner class: @CucumberOptions(features = "src/main/resources/features", glue = {"stepDefinitions"}, //tags = {"~@Ignore"}, //plugin = {"com.cucumber.listener.ExtentCucumberFormatter:"}, plugin = {"pretty","json:target/cucumber-reports/CucumberTestReport.json", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"},monochrome = true)
public class TestRunner extends BaseTest{ static LoginPage loginPage = new LoginPage(); private TestNGCucumberRunner testNGCucumberRunner; public static RemoteWebDriver connection; public ExtentTest test;
// @SuppressWarnings("unused") @Test(groups = "cucumber", description = "Runs Cucumber Scenarios", dataProvider = "scenarios") public void runScenario(PickleWrapper pickleWrapper, FeatureWrapper featureWrapper) throws IOException {
// ExtentTest test = extent.createTest(pickleWrapper.getPickle().getName()); test = extent.createTest(pickleWrapper.getPickle().getName()); test.assignCategory(pickleWrapper.getPickle().getName()); test.createNode("Given", "This is node step"); test.log(test.getStatus(), "Execution Result"); testNGCucumberRunner.runScenario(pickleWrapper.getPickle());
}
Below is BaseTest class:
@BeforeTest(description = "LYFT login") public static void setUp(String uaturl, String uatusername, String uatpassword, String devurl, String devusername, String devpassword) throws IOException { //report for attachment extent = new ExtentReports(); String reportPath = System.getProperty("user.dir")+"/target/Report/HTMLExecutionReport2.html"; ExtentSparkReporter reporter = new ExtentSparkReporter(reportPath); // reporter.config().setReportName("Avent Report"); // reporter.config().setDocumentTitle("Execution Report"); String reportConfigPath = System.getProperty("user.dir")+"/src/test/resources/extent-config.xml"; reporter.loadXMLConfig(reportConfigPath); extent.attachReporter(reporter);