email2vimalraj / CucumberExtentReporter

A plugin to generate the cucumber jvm custom html report using ExtentsReport
http://www.vimalselvam.com/cucumber-extent-reporter/
MIT License
58 stars 74 forks source link

Reports gets appends instead of separate file for each suite #118

Open balakumarmanoharan opened 4 years ago

balakumarmanoharan commented 4 years ago

I am currently running multiple cucumber runner classes via testng.run() option using multi threading.

Runner1.class:

@CucumberOptions(features={"src//test//java//features"},
                 glue = {"stepdefinition"},
                tags = {"@Login,"},
                 plugin = { "com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/Reports1.html"},
                 monochrome = true)

    @Test
    public class Runner1 extends AbstractTestNGCucumberTests
        {
            @AfterClass
            public static void writeExtentReport() throws Exception 
                {
                    RunCucumberTests rct = new RunCucumberTests();
                    rct.writeExtentReports();
                    //Reporter.loadXMLConfig(SignInInterface.HomePath+"/extent-config.xml");
                }
        }

Runner2.class:

@CucumberOptions(features={"src//test//java//features"},
                 glue = {"stepdefinition"},
                tags = {"@Login,"},
                 plugin = { "com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/Reports2.html"},
                 monochrome = true)

    @Test
    public class Runner2 extends AbstractTestNGCucumberTests
        {
            @AfterClass
            public static void writeExtentReport() throws Exception 
                {
                    RunCucumberTests rct = new RunCucumberTests();
                    rct.writeExtentReports();
                    //Reporter.loadXMLConfig(SignInInterface.HomePath+"/extent-config.xml");
                }
        }

Now I want separate reports for each runner class as mentioned Report1.html and Report2.html.

But what is happening right now is, Runner2.class results gets appends to Report1.html itself. There is not separate report.

I suspect this is due to static variables in ExtentCucumberFormatter.java and other listeners.

Kindly help me to get separate reports.