grasshopper7 / extentreports-cucumber6-adapter

Cucumber-JVM 6 Adapter for Extent Framework
https://ghchirp.online/2098/
MIT License
16 stars 15 forks source link

Getting error related to pdf report flush while executing test using maven test #31

Open kawalbhatia opened 3 years ago

kawalbhatia commented 3 years ago

WHile executing the cucumber test using testng runner, getting below error for pdf report :

Feb 02, 2021 12:32:51 PM tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter flush SEVERE: An exception occurred java.util.NoSuchElementException at java.util.ArrayList$Itr.next(ArrayList.java:862) at java.util.Collections.min(Collections.java:598) at tech.grasshopper.pdf.data.ReportData.populateSummaryChapterData(ReportData.java:69) at tech.grasshopper.pdf.data.ReportData.populateChapterData(ReportData.java:29) at tech.grasshopper.pdf.PDFCucumberReport.(PDFCucumberReport.java:57) at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.flush(ExtentPDFCucumberReporter.java:65) at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.access$1(ExtentPDFCucumberReporter.java:57) at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:42) at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:1) at io.reactivex.rxjava3.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:310) at io.reactivex.rxjava3.subjects.PublishSubject.onNext(PublishSubject.java:226) at com.aventstack.extentreports.ReactiveSubject.onFlush(ReactiveSubject.java:83) at com.aventstack.extentreports.AbstractProcessor.onFlush(AbstractProcessor.java:85) at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:284) at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.finishReport(ExtentCucumberAdapter.java:296) at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$6(ExtentCucumberAdapter.java:295) at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:132) at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:1) at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51) at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12) at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:93) at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:74) at io.cucumber.testng.TestNGCucumberRunner.finish(TestNGCucumberRunner.java:126) at io.cucumber.testng.AbstractTestNGCucumberTests.tearDownClass(AbstractTestNGCucumberTests.java:53) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134) at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:63) at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:348) at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:302) at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:217) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:130) at java.util.ArrayList.forEach(ArrayList.java:1257) at org.testng.TestRunner.privateRun(TestRunner.java:766) at org.testng.TestRunner.run(TestRunner.java:587) at org.testng.SuiteRunner.runTest(SuiteRunner.java:384) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337) at org.testng.SuiteRunner.run(SuiteRunner.java:286) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187) at org.testng.TestNG.runSuitesLocally(TestNG.java:1109) at org.testng.TestNG.runSuites(TestNG.java:1039) at org.testng.TestNG.run(TestNG.java:1007) 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)

grasshopper7 commented 3 years ago

What is the cucumber version? Can u add the generated cucumber json file?

Would be great if u can create a minimum sample code which raises this exception. I have had few other folks complain about this same exception but I am unable to reproduce this.

kawalbhatia commented 3 years ago

Hi @grasshopper7 , I am using cucumber version 6.9.0.

I tried digging out again, why we are getting this error, Actually this error happened when by mistake i commented the variable reference (header) in Examples section for scenario outline. But i am not sure why it gives this error . By this error, it is referencing to pdf flush .

Attached is the sample project i created where there is a mistake in test3.feature file and if we execute this using maven test it gives the error. Please let me know in case any additional details are required.

ParallelExecution.zip

grasshopper7 commented 3 years ago

On first glance it seems like the error handling in the pdf report needs to be improved. I will have a detailed look later today or tomorrow. Thanks

kawalbhatia commented 3 years ago

Hi @grasshopper7 , Thanks for your response. May be you are right.This comes if you user puts wrong tag in feature file although tag name similar to what is put in runner file as well. Did you get chance to look at it and fix it. Thanks

grasshopper7 commented 3 years ago

Completely swamped at the moment. Should be able to fix it by the end of this week.

grasshopper7 commented 3 years ago

Have made extensive changes to the PDF report code and layout (page is now landscaped). Added code to check for data validity before report generation. The above should also be fixed. Will release a new version soon.

kawalbhatia commented 3 years ago

Hello @grasshopper7 - Thanks for working on it. Looking forward to have new version of adapter. Please let us know when this would be available. Thanks

grasshopper7 commented 3 years ago

Targeting for monday, fingers crossed. Major changes - landscape, doc string and datatable added, images added. Here is a sample report. - report.pdf

One with custom color - report-custom-colors.pdf

Would appreciate any feedback

kawalbhatia commented 3 years ago

Thanks @grasshopper7 . Like the changes. By any chance can we embed the screenshot in pdf as well for failure scenarios. I understand size might be an issue .but just in case we can convert the image to low resolution image and embed in pdf that would make it complete.

grasshopper7 commented 3 years ago

The screenshots are now available in the report. Check in\around page 18. Though it is pretty small. Are u recommending a full blown image capability?

grasshopper7 commented 3 years ago

The new PDF report is available via the plugin https://search.maven.org/artifact/tech.grasshopper/cucumber-pdf-plugin/1.3.0/maven-plugin. Unfortunately needs some unforeseen code modifications to make it work with the adapter. Hopefully get it out in a couple of days

kawalbhatia commented 3 years ago

Hi @grasshopper7 , Understood.With adapter, it would be seamless implementation as all can use with the BAU process. Also i saw the screenshot , since it was too small , i oversee it . Embedding full image would make it meaningful.

grasshopper7 commented 3 years ago

For that purpose, planning to have an appendix with bigger images and other data which are trimmed. The user can switch it on or off. Should be doable without too much effort.

grasshopper7 commented 3 years ago

Have uploaded version 2.7.0 with the latest PDF report for the adapter. Should be visible in maven in a day or so

kawalbhatia commented 3 years ago

Thank you . Sorry was travelling and was off work for a week. I will try the latest version .

kawalbhatia commented 3 years ago

@grasshopper7 _ i have one more observation that while executing the cucumber project , the output on the console is displayed after a scenario is completely executed and not after a step in a scenario. is it because of the plugin adapter ?