1

I am looking to generate a single Extent PDF Report for Test Execution done on Multiple browsers (Edge, Chrome, Firefox) in a single run.

I am getting the below error when the execution finishes:

SEVERE: An exception occurred
tech.grasshopper.pdf.exception.PdfReportException: java.io.IOException: The TrueType font null does not contain a 'cmap' table
        at tech.grasshopper.pdf.PDFCucumberReport.createReport(PDFCucumberReport.java:129)
        at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.flush(ExtentPDFCucumberReporter.java:88)
        at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter.access$100(ExtentPDFCucumberReporter.java:19)
        at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:62)
        at tech.grasshopper.pdf.extent.ExtentPDFCucumberReporter$1.onNext(ExtentPDFCucumberReporter.java:55)
        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:279)
        at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.finishReport(ExtentCucumberAdapter.java:300)
        at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter.access$600(ExtentCucumberAdapter.java:62)
        at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:136)
        at com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter$8.receive(ExtentCucumberAdapter.java:133)
        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.SynchronizedEventBus.send(SynchronizedEventBus.java:47)
        at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:131)
        at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:118)
        at io.cucumber.testng.TestNGCucumberRunner.finish(TestNGCucumberRunner.java:145)
        at io.cucumber.testng.AbstractTestNGCucumberTests.tearDownClass(AbstractTestNGCucumberTests.java:57)
        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:133)
        at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:62)
        at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:385)
        at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:321)
        at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:217)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:130)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: The TrueType font null does not contain a 'cmap' table
        at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapImpl(TrueTypeFont.java:562)
        at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:542)
        at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:528)
        at org.apache.fontbox.ttf.TTFSubsetter.<init>(TTFSubsetter.java:90)
        at org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.subset(TrueTypeEmbedder.java:347)
        at org.apache.pdfbox.pdmodel.font.PDType0Font.subset(PDType0Font.java:263)
        at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1369)
        at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1344)
        at tech.grasshopper.pdf.PDFCucumberReport.createReport(PDFCucumberReport.java:125)
        ... 33 more

Below is the configuration in extent.properties:

extent.reporter.pdf.start=true
extent.reporter.pdf.out=/Test-report/pdf-reports/Web_Report.pdf

with the above configuration the pdf gets generated fine when the tests are run on only 1 browser at a time.

Any suggestions what changes are required to get the Test Reports of all 3 browsers similar to the Extent HTML Report ?

Automation Engr
  • 444
  • 2
  • 4
  • 26

2 Answers2

0

Check if this is related to grasshopper7/pdfextentreporter issue 1 which reports a similar error.

The author reports having fixed that in version 1.0.0 in Dec. 2021. It should not be tech.grasshopper/extent-pdf-report, since its 1.0.0 is from oct. 2020. But do check the version used.

If that is not enough, you might need to tweka your code to generate those reports one by one.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I had tried that but does not help and end up getting the same error even with the very latest version extent-pdf-report 2.9.1, – Automation Engr Mar 09 '23 at 18:14
  • also FYI, reports do get generated per browser in individual pdf file but my aim here is to have 1 single pdf file having all 3 browsers execution report just like the one generated using spark config in .html format. – Automation Engr Mar 09 '23 at 18:16
  • 1
    @AutomationEngr In that case, it is best to generate 3 pdf, and then merge/assemble them into a final unique PDF. – VonC Mar 09 '23 at 19:35
0

You must could load it into a TrueTypeFont and keep that one. With load function loads a TTF to be embedded into a document as a Type 0 font.

public static PDType0Font load(PDDocument doc, TrueTypeFont ttf, boolean embedSubset) throws IOException

You can find more information here:

Class PDType0Font Documentation

The TrueType font does not contain a 'cmap' table

borchvm
  • 3,533
  • 16
  • 44
  • 45