Skip to main content
Code format
Source Link
Kate Paulk
  • 31.5k
  • 8
  • 55
  • 109

I had the similar requirement. I achieved it. (Extent Report V3 and above)

BaseTest is being extended by all the test class.

Class BaseTest{

Class BaseTest{

        public static ExtentReports extent =new ExtentReports();//initiating here is very important
        public static ExtentHtmlReporter htmlReporter;

@BeforeSuite
    public void beforeSuiteSetup() {
        String filepath = System.getProperty("user.dir");
        htmlReporter = new ExtentHtmlReporter(filepath+"/Report.html");     
        extent.attachReporter(htmlReporter);
    }

@AfterSuite(alwaysRun = true)
    public void afterSuite() {
        extent.flush();
    }

}

I had the similar requirement. I achieved it. (Extent Report V3 and above)

BaseTest is being extended by all the test class.

Class BaseTest{

        public static ExtentReports extent =new ExtentReports();//initiating here is very important
        public static ExtentHtmlReporter htmlReporter;

@BeforeSuite
    public void beforeSuiteSetup() {
        String filepath = System.getProperty("user.dir");
        htmlReporter = new ExtentHtmlReporter(filepath+"/Report.html");     
        extent.attachReporter(htmlReporter);
    }

@AfterSuite(alwaysRun = true)
    public void afterSuite() {
        extent.flush();
    }

}

I had the similar requirement. I achieved it. (Extent Report V3 and above)

BaseTest is being extended by all the test class.

Class BaseTest{

        public static ExtentReports extent =new ExtentReports();//initiating here is very important
        public static ExtentHtmlReporter htmlReporter;

@BeforeSuite
    public void beforeSuiteSetup() {
        String filepath = System.getProperty("user.dir");
        htmlReporter = new ExtentHtmlReporter(filepath+"/Report.html");     
        extent.attachReporter(htmlReporter);
    }

@AfterSuite(alwaysRun = true)
    public void afterSuite() {
        extent.flush();
    }

}
Source Link

I had the similar requirement. I achieved it. (Extent Report V3 and above)

BaseTest is being extended by all the test class.

Class BaseTest{

        public static ExtentReports extent =new ExtentReports();//initiating here is very important
        public static ExtentHtmlReporter htmlReporter;

@BeforeSuite
    public void beforeSuiteSetup() {
        String filepath = System.getProperty("user.dir");
        htmlReporter = new ExtentHtmlReporter(filepath+"/Report.html");     
        extent.attachReporter(htmlReporter);
    }

@AfterSuite(alwaysRun = true)
    public void afterSuite() {
        extent.flush();
    }

}