extent-framework / extentreports-java

Extent Reporting Library, Java
http://extentreports.com
Apache License 2.0
226 stars 127 forks source link

Error when enabling offline mode in 4.1.2 #122

Closed datagitlies closed 4 years ago

datagitlies commented 4 years ago

Below is the error / stack trace. This should be a simple fix in ExtentHtmlReporterConfiguration to cast to a BasicFileReporter instead of an ExtentSparkReporter. I'll open a pull request soon unless someone beats me to it.

java.lang.ClassCastException: com.aventstack.extentreports.reporter.ExtentHtmlReporter cannot be cast to com.aventstack.extentreports.reporter.ExtentSparkReporter
    at com.aventstack.extentreports.reporter.configuration.ExtentHtmlReporterConfiguration.enableOfflineMode(ExtentHtmlReporterConfiguration.java:31)
    at com.aventstack.extentreports.reporter.ExtentHtmlReporter.flush(ExtentHtmlReporter.java:49)
    at com.aventstack.extentreports.ReportObservable.lambda$23(ReportObservable.java:526)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
    at com.aventstack.extentreports.ReportObservable.notifyReporters(ReportObservable.java:526)
    at com.aventstack.extentreports.ReportObservable.flush(ReportObservable.java:424)
    at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:290)
    at com.aventstack.extentreports.testng.listener.ExtentITestListenerClassAdapter.onFinish(ExtentITestListenerClassAdapter.java:20)
    at org.testng.TestRunner.fireEvent(TestRunner.java:772)
    at org.testng.TestRunner.afterRun(TestRunner.java:741)
    at org.testng.TestRunner.run(TestRunner.java:509)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
    at org.testng.SuiteRunner.run(SuiteRunner.java:364)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
    at org.testng.TestNG.runSuites(TestNG.java:1049)
    at org.testng.TestNG.run(TestNG.java:1017)
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:283)
    at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
    at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
    at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Ashwini1980 commented 4 years ago

I upgraded to 4.1.3 and now I am getting:

java.lang.ClassCastException: com.aventstack.extentreports.reporter.ExtentHtmlReporter cannot be cast to com.aventstack.extentreports.reporter.ExtentSparkReporter at com.aventstack.extentreports.reporter.configuration.ExtentHtmlReporterConfiguration.enableOfflineMode(ExtentHtmlReporterConfiguration.java:31) at com.aventstack.extentreports.reporter.ExtentHtmlReporter.flush(ExtentHtmlReporter.java:49) at com.aventstack.extentreports.ReportObservable.lambda$23(ReportObservable.java:526) at java.util.ArrayList.forEach(Unknown Source) at com.aventstack.extentreports.ReportObservable.notifyReporters(ReportObservable.java:526) at com.aventstack.extentreports.ReportObservable.flush(ReportObservable.java:424) at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:290) at com.home.listener.ExtentITestListenerAdapter.onFinish(ExtentITestListenerAdapter.java:51) at org.testng.TestRunner.fireEvent(TestRunner.java:899) at org.testng.TestRunner.afterRun(TestRunner.java:863) at org.testng.TestRunner.run(TestRunner.java:594) at org.testng.SuiteRunner.runTest(SuiteRunner.java:402) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:396) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:355) at org.testng.SuiteRunner.run(SuiteRunner.java:304) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1180) at org.testng.TestNG.runSuitesLocally(TestNG.java:1102) at org.testng.TestNG.runSuites(TestNG.java:1032) at org.testng.TestNG.run(TestNG.java:1000) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)