ExtentReports PDF Reporter

NEW Posts – Generating Spark and Pdf Extent Report for “Rest Assured with Maven plugin” and “Rest Assured and Cucumber with Maven plugin”

Introduction

ExtentReports library is used for creating detailed and interactive test reports. The browser based Spark report is the most common report format. This article introduces the PDF format along with creation steps, various sections and configuration settings.

The report contains four sections – summary section with a dashboard and attribute summary, test details section, attribute details section and media section. There is a one to one mapping between the Spark and PDF reports. The summary section maps to the dashboard tab of the Spark report. The test details section maps to the test tab of the Spark report. The attribute details section maps to the category, author, device and exception tabs.

The report display varies depending on the AnalysisStrategy selected. The article assumes the default TEST strategy for explaining the report sections. The differences for the remaining strategies are mentioned separately.

The PDF report is a single file with the medias embedded in it. This allows it to be shared easily without need of zipping and extracting contents. This convenience comes with the issue of file size, if report contains numerous medias. This report currently does not support base64 media.

The report uses MIT or Apache licensed code for PDF display which removes any licensing issues. Following are the PDF related dependencies – PDFBox, easytable and pdfbox-layout. The report uses the open source Liberation Sans font family.

Source

The sample report implementation can be found at this location. Code (TESTSimpleReport) for creating a report with tests containing logs, generated logs, exception logs and media logs. Code (TESTMarkupReport) for creating a report with tests containing markup logs. Code (TESTComboReport) for creating a report with tests containing text, exception and media logs combination. Code (BDDReport) for creating a report with BDD tests.

The PDF report source can be found here.

Report Creation

The following dependency needs to be added for creating the Extent PDF report.

<dependency>
	<groupId>tech.grasshopper</groupId>
	<artifactId>pdfextentreporter</artifactId>
	<version>1.3.2</version>
</dependency>

The following code is used for initializing the ExtentReport and adding the PDF reporter.

ExtentReports extent = new ExtentReports();
ExtentPDFReporter pdf = new ExtentPDFReporter("Pdf.pdf");
extent.attachReporter(pdf);

This will create the report with default configuration settings. The default settings can be found here in JSON and XML format. These are just for illustration purposes and changing them will have no effect on the report. Custom configuration can be added via a JSON or XML format. The details of the settings is described in the ‘Configuration’ section below.

// JSON configuration file
pdf.loadJSONConfig(new File("src/test/resources/pdf-config.json"));

// XML configuration file
pdf.loadXMLConfig(new File("src/test/resources/pdf-config.xml"));

Summary Section

This section contains of the dashboard which summarizes the test execution details. The display contains report title, report creation date, test start time, test end time, test duration, test pass count, test fail count and test status pie charts. The dashboard display varies depending on the selected AnalysisStrategy. The dashboard will always be generated.

The dashboard image on the left shows the default color scheme. The image on the right shows the colors selected in the XML and JSON configuration.

This section also contains test status details of category, author and device attributes. This also contains the name value pair details of system information attributes. This is optional and can be toggled on and off by using the displayAttributeSummary setting. This is set to true by default.

Test Details Section

This section contains the details of each test including the attached logs. The display includes test name, test description, start time, end time, duration, category, author, device and medias attached to the test. The generated logs and logs are displayed in tabular fashion. This is optional and can be toggled on and off by using the displayTestDetails setting. This is set to true by default.

The test hierarchy image on the right shows the indent of the child tests to the right. The test level to which the indent is applied is decided by the testMaxIndentLevel setting which is described in the Configuration section.

The images are thumbnail size, and the expanded display can be seen by clicking on the plus sign. These expanded images are contained in the Media section which is described below. For the top level test, only the first 6 attached test medias are displayed. The test media display count decreases with the child test indentation. The others are displayed in the Media section.

The report supports markups like label text, table, lists and code blocks.

Label Markup

The label markup creation code requires the color value to be provided as an instance of ExtentColor enumeration. This value needs to match the color value available in java.awt.Color class. When there is no match the label background color defaults to black.

Table Markup

The image on the right displays the information message when the number of table columns exceeds the value set by the maxTableColumnCount. This is described in the Configuration section below.

List Markup
Code Markup

The image below displays the image for multiple code blocks added to the same test log.

Attribute Details Section

This section contains the mapping of each category, device and author attributes to the tests to which they are added. The mapping of the exception class and the test is also displayed. This also includes the summary of all test statuses. This is optional and can be toggled on and off by using the displayAttributeDetails setting. This is set to true by default.

Media Section

This section contains the expanded images of the thumbnails displayed in the Test section. The size of the images are to full scale maximum, else the size is restricted by the available page width. The expanded image can be navigated by clicking on the red plus sign next to the thumbnail. This is optional and can be toggled on and off by using the displayExpandedMedia setting. This is set to true by default.

Media Attachment

Adding images and screenshots to the report are a major requirement. The PDF report currently does NOT support base64 string images. This section will look at the case when a Spark report is already being generated and also when fresh Extent reports are created.

Existing Spark Report

If the media paths are absolute or the media folder path is set using the setMediaResolverPath() of the ExtentReports class in the Spark report, then NO changes are required. The below code is for the later case and the files will be available in the ‘images’ folder in the project root.

ExtentReports extent = new ExtentReports();
extent.setMediaResolverPath(new String[] { "images" });

When the media paths are relative to the Spark report location, then the PDF report needs the information of the media folder path relative to the project root. Below is a sample of an existing Spark report code which is generated in the reports folder and the media is stored in the ‘images’ child folder.

ExtentSparkReporter sparkReport = new ExtentSparkReporter("reports/BDDSparkReport.html");		extent.attachReporter(sparkReport);
..
test.log(Status.PASS, MediaEntityBuilder.createScreenCaptureFromPath("images/screen.png")

The media folder path is configured by passing a String array to the setMediaFolders() method of the configuration class. Multiple path values can be passed in the array, the first path which successfully finds the file is used.

ExtentPDFReporter pdfReport = new ExtentPDFReporter("reports/BDDPDFReport.pdf");
		extent.attachReporter(pdfReport);
pdfReport.config().setMediaFolders(new String[] { "reports/images"});

The above setting can also be passed in the JSON configuration file by using mediaFolders as the json element name and the value as a json array. This however does not currently work with the XML configuration and will be fixed in future release.

When the PDF report cannot locate the media file from the given path, then it will automatically search for the image in the project root followed by the child directories ‘images’, ‘medias’ and ‘screenshots’ in that order. If the medias are stored in these folder names under the project root then there is no need to use the setMediaFolders() setting.

This might seem similar to using the setMediaResolverPath() method but using this will change the existing paths of the Spark report. This might lead to undesirable side effects and best avoided.

Fresh Extent Report Creation

The easiest way is to use the setMediaResolverPath() method and set the relative media folder locations in the array. Then just the media file names can be mentioned in the createScreenCaptureFromPath() method. At the end of the day, it is the project requirements that will guide the technique adapted.

Configurations

The PDF report look and feel can be modified by creating a JSON or XML configuration settings file. The settings which need a color value, it is required to be in a hex format without the “#” at the start.

Section Creation Settings

As mentioned above the following settings can be used to toggle on and off the respective section creation.

Section Creation SettingDescriptionDefault Value
displayAttributeSummaryDisplays the attribute summary of the dashboard sectiontrue
displayTestDetailsDisplays the test details sectiontrue
displayAttributeDetailsDisplays the attribute details sectiontrue
displayExpandedMediaDisplays the expanded media sectiontrue
Summary Section Settings

Below are the color and detail settings for the dashboard display.

Dashboard Display SettingDescriptionDefault Value
titleReport title textPDF Extent Report
titleColorReport title text colorBlack
dateFormatterReport creation date time format, default will be used in case of parsing errorFormatStyle.MEDIUM
dateColorReport creation text colorBlue
startTimesColorTest execution start time textRed
finishTimesColorTest execution finish time textRed
durationColorTest duration text colorRed
passCountColorTest passed count text colorRed
failCountColorTest failed count text colorRed
passColorPass test and test log status colorGreen
failColorFail test and test log status colorRed
skipColorSkip test and test log status colorOrange
warnColorWarning test and test log status colorYellow
infoColorInfo test and test log status colorBlue

Below are the color settings for the attribute summary display.

Attribute Summary Display SettingDescriptionDefault Value
categoryAttributeColorCategory title text colorCyan
categoryNameColorCategory attribute name text colorBlack
authorAttributeColorAuthor title text colorMagenta
authorNameColorAuthor attribute name text colorBlack
deviceAttributeColorDevice title text colorDark Grey
deviceNameColorDevice attribute name text colorBlack
systemAttributeColorSystem Info title text colorYellow
systemNameColorSystem Info name text colorBlack
systemValueColorSystem Info value text colorBlack

The category, author and device attribute test status counts text color are the picked from the passColor, failColor, skipColor, warnColor and infoColor settings as described in the Dashboard settings.

Test Details Section Settings

Below are the color settings for the test details display.

Test Display Display SettingDescriptionDefault Value
testNameColorTest name text colorRed
testDescriptionColorTest description text colorBlack
testTimesColorTest start, finish and duration text colorBlue
testTimeStampColorTest log timestamp text colorBlack
testExceptionColorTest log exception stacktrace colorRed
maxTableColumnCountMaximum count of columns to display for tables5
testMaxIndentLevelMaximum test level in the hierarchy which will be indented2

The test log status and details color are the picked from the passColor, failColor, skipColor, warnColor and infoColor settings as described in the Dashboard settings.

Attribute Details Section

Below are the color settings for the attribute details display.

Attribute Details Display SettingDescriptionDefault Value
exceptionAttributeColorException class name text colorRed

The test status color are the picked from the passColor, failColor, skipColor, warnColor and infoColor settings as described in the Dashboard settings. The category, author and device attribute name colors are the picked from the categoryAttributeColor, authorAttributeColor and deviceAttributeColor settings as described in the Attribute Summary settings. The timestamp text color is picked from the testTimeStampColor as described in the Test Details settings.

BDD Analysis Strategy Report

ExtentReports will choose this strategy automatically if all the tests are of BDD type. The type refers to classes of the type IGherkinFormatterModel. The display changes are for the dashboard, test and media sections.

The report displays logs and medias for Level 2 tests only. In case the Level 1 test is of ScenarioOutline type then the Level 3 tests are considered. The tests with higher level values are not displayed in the report.

Summary Section

In the dashboard, “Tests Passed” and “Tests Failed” are renamed as “Features Passed” and “Features Failed” respectively. The pie chart count is three named, Features, Scenarios and Steps.

The attribute summary section is the same as the display for the default TEST strategy. The attributes for higher levels are also considered, which matches the Spark report.

Test Details Section

As mentioned above, logs and medias for Level 2 tests and Level 3 in case of a Level 1 ScenarioOutline type, are only displayed.

Attribute Details Section

The attribute summary section is the same as the display for the default TEST strategy. The attributes for higher levels are also considered, which matches the Spark report.

Media Section

As mentioned above, expanded medias for Level 2 tests and Level 3 in case of a Level 1 ScenarioOutline type, are only displayed.

Class & Suite Analysis Strategy Report

For the CLASS strategy, in the dashboard page “Tests Passed” and “Tests Failed” are renamed as “Class Passed” and “Class Failed” respectively. The pie chart headers are named, Class, Methods and Log Events.

For the SUITE strategy, in the dashboard page “Tests Passed” and “Tests Failed” are renamed as “Suite Passed” and “Suite Failed” respectively. The pie chart headers are named, Suite, Class, Test and Log Events.

56 thoughts on “ExtentReports PDF Reporter”

  1. Hi Mounish ,

    I’m using the following dependency with extent.properties and extent-config.xml.

    tech.grasshopper
    extentreports-cucumber7-adapter
    1.14.0

    When I run any tests, the pdf and html reports are generated fine but, when I enable rerun on failure with the following in pom.xml, and failed tests are automatically re-executed, the pdf report gets corrupted. Is there any solution for this? Any help is much appreciated
    1

    Thanks,
    Kiran

  2. Hi,
    When I run my tests with maven -failsafe plugin 2, the failed tests would get re-executed twice and the pdf report is getting corrupted. But, when rerun is disabled, the pdf report seems fine. Any thoughts whats happening? I’m completely lost. Any help is appreciated.

    Thanks
    Kiran

  3. Hi,
    In the TESTSimpleReport, the Dashboard is showing 4 Donuts, but for me the donuts titled Steps are showing 0 where the first and the log level donuts are showing proper color and result.
    How do I achieve the Steps donuts as well.

    Thanks
    Aakshan

      1. I have added the createNode() to achieve that. see the code below:

        public void onTestStart(ITestResult result) {
        // TODO Auto-generated method stub
        //System.out.println(“Test Description from Test name ” + result.getName().);
        ExtentTest test = extent
        .createTest(result.getTestClass().getName() + “:: ” + result.getMethod().getMethodName(),
        result.getMethod().getDescription())
        .createNode(result.getTestClass().getName())
        .createNode(result.getMethod().getMethodName())
        .assignAuthor(“Chimera QA Team”)
        .assignCategory(result.getMethod().getGroups())
        .assignDevice(“Windows “);
        extentTest.set(test);

  4. Hi Mounish,

    In the extent reports generated using the script I am using, I could see only 2 pie diagrams, but the PDF report has 4 that includes 2 diagram for Steps. I have sent the screenshot to your email. How do I achieve the Steps ?

    Thanks
    Renjith

  5. Hi,

    I was trying to generate a pdf file from the extent reports I use. The first issue is the .pdf file is not getting created in the folder.

    I am using Selenium Java, TestNg to automate. I am able to create the HTML files in the stipulated folder successfully.

    Here is the code snippet:

    public class ExtentManager {

    private static ExtentReports reports = new ExtentReports();

    public static ExtentReports createInstance() {

    /*String fileName = getReportName();
    String directory = System.getProperty(“user.dir”) + “target/test-output/ExtentReport/”;
    new File(directory).mkdirs();
    String path = directory + fileName;
    */
    reports.setMediaResolverPath(new String[] { “images” });
    // PDF REPORT GEN
    ExtentPDFReporter extentPDF = new ExtentPDFReporter(“target/test-output/ExtentPDF/reports.pdf”);
    try {
    extentPDF.loadJSONConfig(new File(“extent-report/extent-report-config.json”));

    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    reports.attachReporter(extentPDF);

    ExtentSparkReporter htmlrepoter;
    htmlrepoter = new ExtentSparkReporter(“target/test-output/ExtentReport/extent.html”);

    // ALL THE REPORT CONFIGURATION IS NOW SET IN JSON FILE
    try {
    htmlrepoter.loadJSONConfig(new File(“extent-report/extent-report-config.json”));

    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    // HERE THE ORDER OF THE VIEW CAN BE CONFIGURED
    htmlrepoter.viewConfigurer().viewOrder().as(new ViewName[] {
    ViewName.DASHBOARD,
    ViewName.TEST,
    ViewName.EXCEPTION,
    ViewName.CATEGORY,
    ViewName.DEVICE,
    ViewName.AUTHOR,
    ViewName.LOG
    }).apply();

    /
    reports.attachReporter(htmlrepoter);
    //return reports;

    return reports;
    }

    public static String getReportName() {

    Date d = new Date();
    String fileName = “Automation_Report” + “_” + d.toString().replace(“:”, “_”).replace(” “, “_”) + “.png”;
    return fileName;
    }
    }

    Thanks
    Renjith

    1. here is what I see in the logs:
      java.lang.NoSuchMethodError: ‘org.jsoup.nodes.Element org.jsoup.nodes.Document.selectFirst(java.lang.String)’
      at tech.grasshopper.reporter.tests.markup.TestMarkup.createMarkupCell(TestMarkup.java:57)
      at tech.grasshopper.reporter.tests.LogDetailsCollector.createDetailsMarkupCell(LogDetailsCollector.java:93)
      at tech.grasshopper.reporter.tests.LogDetailsCollector.createLogDetailCells(LogDetailsCollector.java:70)
      at tech.grasshopper.reporter.tests.TestLogsDisplay.createLogDisplayCell(TestLogsDisplay.java:117)
      at tech.grasshopper.reporter.tests.TestLogsDisplay.lambda$createLogRows$0(TestLogsDisplay.java:92)
      at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
      at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2093)
      at tech.grasshopper.reporter.tests.TestLogsDisplay.createLogRows(TestLogsDisplay.java:91)
      at tech.grasshopper.reporter.tests.TestLogsDisplay.display(TestLogsDisplay.java:61)
      at tech.grasshopper.reporter.tests.TestDetails.displayTestLogs(TestDetails.java:59)
      at tech.grasshopper.reporter.tests.TestDetails.displayTestAndLogDetails(TestDetails.java:51)
      at tech.grasshopper.reporter.tests.TestDetails.createSection(TestDetails.java:42)
      at tech.grasshopper.reporter.ReportGenerator.createTestDetailsSection(ReportGenerator.java:120)
      at tech.grasshopper.reporter.ReportGenerator.generate(ReportGenerator.java:60)
      at tech.grasshopper.reporter.ExtentPDFReporter.flush(ExtentPDFReporter.java:105)
      at tech.grasshopper.reporter.ExtentPDFReporter.access$100(ExtentPDFReporter.java:20)
      at tech.grasshopper.reporter.ExtentPDFReporter$1.onNext(ExtentPDFReporter.java:84)
      at tech.grasshopper.reporter.ExtentPDFReporter$1.onNext(ExtentPDFReporter.java:77)
      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.chimera.base.TestListeners.onFinish(TestListeners.java:60)
      at org.testng.TestRunner.fireEvent(TestRunner.java:895)
      at org.testng.TestRunner.afterRun(TestRunner.java:859)
      at org.testng.TestRunner.run(TestRunner.java:590)
      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.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)

        1. ExtentPDFReporter extentPDF = new ExtentPDFReporter(“target/test-output/ExtentPDF/reports.pdf”);
          try {
          extentPDF.loadJSONConfig(new File(“extent-report/extent-report-config.json”));

          } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          }
          I am using TestListener class to add the logText() like, fail, pass, skip.
          Is there anything else should I configure, apart from the maven dependency.

          Thanks
          Renjith
          reports.attachReporter(extentPDF);

          Here the reports.attachReporter() is not actually adding the .pdf file in the folder.

        2. // PDF REPORT GEN
          ExtentPDFReporter extentPDF = new ExtentPDFReporter(“target/test-output/ExtentPDF/reports.pdf”);
          try {
          extentPDF.loadJSONConfig(new File(“extent-report/extent-report-config.json”));

          } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          }

          reports.attachReporter(extentPDF);

          I am using a TestListener class to capture the logtexts
          The current issue I am facing is the PDF is not getting created.

            1. Tried the TestSimpleReport()
              butting getting the following error,
              Exception in thread “main” java.lang.NoSuchMethodError: ‘org.jsoup.nodes.Element org.jsoup.nodes.Document.selectFirst(java.lang.String)’
              at tech.grasshopper.reporter.tests.markup.TestMarkup.createMarkupCell(TestMarkup.java:57)
              at tech.grasshopper.reporter.tests.TestGeneratedLogDisplay.lambda$createLogRows$0(TestGeneratedLogDisplay.java:75)
              at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
              at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2093)
              at tech.grasshopper.reporter.tests.TestGeneratedLogDisplay.createLogRows(TestGeneratedLogDisplay.java:72)
              at tech.grasshopper.reporter.tests.TestGeneratedLogDisplay.display(TestGeneratedLogDisplay.java:52)
              at tech.grasshopper.reporter.tests.TestDetails.displayTestGeneratedLogs(TestDetails.java:69)
              at tech.grasshopper.reporter.tests.TestDetails.displayTestAndLogDetails(TestDetails.java:50)
              at tech.grasshopper.reporter.tests.TestDetails.createSection(TestDetails.java:42)
              at tech.grasshopper.reporter.ReportGenerator.createTestDetailsSection(ReportGenerator.java:120)
              at tech.grasshopper.reporter.ReportGenerator.generate(ReportGenerator.java:60)
              at tech.grasshopper.reporter.ExtentPDFReporter.flush(ExtentPDFReporter.java:105)
              at tech.grasshopper.reporter.ExtentPDFReporter.access$100(ExtentPDFReporter.java:20)
              at tech.grasshopper.reporter.ExtentPDFReporter$1.onNext(ExtentPDFReporter.java:84)
              at tech.grasshopper.reporter.ExtentPDFReporter$1.onNext(ExtentPDFReporter.java:77)
              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.name.script.webui.TESTSimpleReport.main(TESTSimpleReport.java:59)

              1. Please remove this dependency as the pdf report is using a higher version jar which it transitively imports.

              2. Thanks Mounish,
                After removing the dependency from POM, the script started creating the pdf files.

                Regards
                Renjith

  6. Hi ,
    I am creating both Extent HTML and PDF report but in HTML report I have added some HTML tags (for bold text and color) but these HTML tags come in Extent PDF report.
    How can i remove html tag from pdf report???

    1. To what have you added this tags too? Logs? Test Name? Test Description? Or something else?
      I will have to check from the code how this is handled. Thanks.

      1. logger=reports.createTest(ExcelUtilities.readData(file, “sheet”,i,0))
        .generateLog(Status.PASS, MarkupHelper.createTable(TestTable));
        logger.log(Status.INFO,
        ” + “DataBase Result”+”“+””+””+”DB.Table: “+table+””+”status: “+status+””+”msg: “+msg);

    1. Sorry this is not possible currently. I am exploring option to allow users to install their own font libraries but have not been very successful yet. This has been asked by other users too.
      Also I am not clear about issues (maybe legal) regarding font libraries which are not free to use but paid, via licenses. Thanks.

      1. I will wait new version, ExtentReports PDF Reporter is very good for me but can’t use it because display font not support my language

        1. What language are you looking to be supported?
          What is the error you are currently receiving ? Or no report is being generated at all?
          Thanks

          1. I use Thai language and in report font display only “???????” when I use Thai language but English is normally display, Picture and others are good display in report.

  7. I have tried this utility and able to generate pdf, however pdf is only generated if test suite has only one tests, if test suite has mote than one test then it is not generating pdf. Any idea what could be wrong?

    1. There is no relationship between test suite (junit or testng) and the extent test. are you creating multiple instances of ExtentPDFReporter, pointing to the same pdf file.
      Can you share a sample repository, to get a better idea?

      1. HI Mounish,

        No, I am using one instance for pdf, but I am generating both html and pdf.

        ExtentSparkReporter html = new ExtentSparkReporter(fileName);
        ExtentPDFReporter pdf = new ExtentPDFReporter(pdffilename);
        extent = new ExtentReports();
        extent.attachReporter(html, pdf);

        Html report is working fine. Whereas pdf as I mentioned earlier only works if only 1 test case is there.

        Thanks,
        Aadi

          1. Hi,

            This is the error I am getting, sorry I should have included this earlier.

            Apr 01, 2022 3:44:01 PM tech.grasshopper.reporter.ExtentPDFReporter flush
            SEVERE: An exception occurred
            org.vandeseer.easytable.RowIsTooHighException: There is a row that is too high to be drawn on a single page
            at org.vandeseer.easytable.TableDrawer.computeRowsOnPagesWithNewPageStartOf(TableDrawer.java:115)
            at org.vandeseer.easytable.TableDrawer.draw(TableDrawer.java:152)
            at org.vandeseer.easytable.RepeatedHeaderTableDrawer.draw(RepeatedHeaderTableDrawer.java:89)
            at tech.grasshopper.reporter.structure.TableCreator.displayTable(TableCreator.java:56)
            at tech.grasshopper.reporter.tests.TestBasicDetailsDisplay.drawTable(TestBasicDetailsDisplay.java:166)
            at tech.grasshopper.reporter.tests.TestBasicDetailsDisplay.display(TestBasicDetailsDisplay.java:81)
            at tech.grasshopper.reporter.tests.TestDetails.createSection(TestDetails.java:46)
            at tech.grasshopper.reporter.ReportGenerator.generate(ReportGenerator.java:68)
            at tech.grasshopper.reporter.ExtentPDFReporter.flush(ExtentPDFReporter.java:105)
            at tech.grasshopper.reporter.ExtentPDFReporter.access$100(ExtentPDFReporter.java:20)
            at tech.grasshopper.reporter.ExtentPDFReporter$1.onNext(ExtentPDFReporter.java:84)
            at tech.grasshopper.reporter.ExtentPDFReporter$1.onNext(ExtentPDFReporter.java:77)
            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.cybersource.test.reporting.ExtentReporter.onExecutionFinish(ExtentReporter.java:24)
            at org.testng.TestNG.runExecutionListeners(TestNG.java:1063)
            at org.testng.TestNG.run(TestNG.java:1025)
            at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:73)
            at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)

              1. Have to dig deep into the code as have been unable to replicate it. Will try it out later tonight.
                Would move things along if u can share the data (cleansed up) which is producing the error. Thx

              2. Yes most of them has long names. I will how I can filter out data and share with you.

              3. No need for data. I created large names. Give the new artifact a try when available and let me know if it works. thx.

              4. I need the sanitized data to figure out what is going on. Can u create a minimum example repo and share the link?

        1. Hi Aadi,
          Were the html and pdf file creation happened using the above mentioned code?
          I tried, but only html is getting created that too, if it is mentioned as first argument.

          Any suggestions?

          Thanks
          Renjith

  8. Hi ,
    I am using “pdfextentreporter” but facing issue when I want to change the configuration using JSON file that you had mentioned in your github link “https://github.com/grasshopper7/pdf-extent-report/blob/master/pdf-extent-report/src/test/resources/pdf-config.json” . But while using the same with XML file I am getting desired output, I guess there is some problem with JSON file present under Github.

    Issue while running my test cases :

    “com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $”

    Can you please help me, I do not want to use XML file.
    I tried to convert the working XML config to JSON.
    Got this, but still it was not working. Can you please me with valid JSON file so that I can use it.

    JSON after converting XML to JSON.
    {
    “configuration”: {
    “title”: “Extent Report PDF”,
    “titleColor”: “964B00”,
    “startTimesColor”: “33A532”,
    “finishTimesColor”: “FF69B4”,
    “durationColor”: “00FFFF”,
    “passCountColor”: “C0C0C0”,
    “failCountColor”: “A9A9A9”,
    “passColor”: “0b8c47”,
    “failColor”: “720000”,
    “skipColor”: “b17750”,
    “warnColor”: “ffc100”,
    “infoColor”: “114444”,
    “categoryTitleColor”: “990000”,
    “categoryNameColor”: “bd8275”,
    “authorTitleColor”: “002288”,
    “authorNameColor”: “3ac5b6”,
    “deviceTitleColor”: “228800”,
    “deviceNameColor”: “cd17bf”,
    “systemTitleColor”: “bb1144”,
    “systemNameColor”: “990000”,
    “systemValueColor”: “daa520”,
    “exceptionTitleColor”: “000000”,
    “attributeTestStatusColor”: “660066”,
    “testNameColor”: “d62d20”,
    “testTimesColor”: “ffa700”,
    “testTimeStampColor”: “08080”,
    “testExceptionColor”: “990000”
    }
    }

    Thanks & Regards
    Kislaya

      1. Hi Mounish,
        I had tried with below Json as well. I am getting same issue, can you please check. Also it would be great help if you could share me your Json File.

        {
        “title”: “Extent Report PDF”,
        “titleColor”: “964B00”,
        “startTimesColor”: “33A532”,
        “finishTimesColor”: “FF69B4”,
        “durationColor”: “00FFFF”,
        “passCountColor”: “C0C0C0”,
        “failCountColor”: “A9A9A9”,
        “passColor”: “0b8c47”,
        “failColor”: “720000”,
        “skipColor”: “b17750”,
        “warnColor”: “ffc100”,
        “infoColor”: “114444”,
        “categoryTitleColor”: “990000”,
        “categoryNameColor”: “bd8275”,
        “authorTitleColor”: “002288”,
        “authorNameColor”: “3ac5b6”,
        “deviceTitleColor”: “228800”,
        “deviceNameColor”: “cd17bf”,
        “systemTitleColor”: “bb1144”,
        “systemNameColor”: “990000”,
        “systemValueColor”: “daa520”,
        “exceptionTitleColor”: “000000”,
        “attributeTestStatusColor”: “660066”,
        “testNameColor”: “d62d20”,
        “testTimesColor”: “ffa700”,
        “testTimeStampColor”: “08080”,
        “testExceptionColor”: “990000”
        }

        1. The json file I am using is the same one present in github. Did u checkout the file or just copied the contents? Try to validate the json – https://jsonlint.com/.

          This is what I have in my IDE currently.
          {
          “displayAttributeSummary”: true,
          “displayAttributeDetails”: true,
          “displayTestDetails”: true,
          “displayExpandedMedia”: true,
          “title”: “Extent Report PDF”,
          “titleColor”: “964B00”,
          “startTimesColor”: “33A532”,
          “finishTimesColor”: “FF69B4”,
          “durationColor”: “00FFFF”,
          “passCountColor”: “C0C0C0”,
          “failCountColor”: “A9A9A9”,
          “passColor”: “0b8c47”,
          “failColor”: “720000”,
          “skipColor”: “b17750”,
          “warnColor”: “ffc100”,
          “infoColor”: “114444”,
          “categoryTitleColor”: “990000”,
          “categoryNameColor”: “bd8275”,
          “authorTitleColor”: “002288”,
          “authorNameColor”: “3ac5b6”,
          “deviceTitleColor”: “228800”,
          “deviceNameColor”: “cd17bf”,
          “systemTitleColor”: “bb1144”,
          “systemNameColor”: “990000”,
          “systemValueColor”: “daa520”,
          “exceptionTitleColor”: “000000”,
          “attributeTestStatusColor”: “660066”,
          “testNameColor”: “d62d20”,
          “testTimesColor”: “ffa700”,
          “testTimeStampColor”: “08080”,
          “testExceptionColor”: “990000”
          }

  9. The report looks interesting. Thanks for the PFD report implementation.

    Are you planning to this report implementation to the cucumber extent 6 example project?

    1. The PDF report is already available for cucumber6 and cucumber 5 adapters, though the displays are different. Search for ‘PDF Extent Report’ at https://ghauto.tech/2098/ and for a more detailed explanation refer to https://ghauto.tech/2224/. This feature needs to be enabled by setting extent.reporter.pdf.start=true and setting the location with extent.reporter.pdf.out in extent.properties. A sample implementation is available at https://github.com/grasshopper7/cuke6-extent-adapter-report/tree/master/cuke6-extent-adapter-report. There is a youtube video highlighting this report – https://www.youtube.com/watch?v=CC_8mn91uKU by a tech blogger. Give it a try with the latest version 2.8.2. Thx.

  10. Hi Mounish,

    How we can pass Tags to the Subject of email once we have a run done.
    I checked in pdf-config yml just see ‘detailedScenarioConfig:’ section.

    Can you please advise
    Thank You

    1. I am not able to understand the requirement. Can u add some more details? Also not sure u r commenting in the right article. Thanks.

      1. Sir requirement is in Runnerclass we have tags defined or in we can pass tags as parameters once the pdf is generated, I need to have the tags passed to the Subject once run is done.
        Using Cucumber 6 , with extentreports-cucumber6-adapter 2.8.2
        Apologies yes I could not find the section so raised here

        Thanks VS

        1. I do not think this is possible. There is no integration between report and mailing functionality. U will need to handle it manually. All I can suggest is to duplicate the tags in a text file and in the mailing code access it.
          No need for apologies. U can add further comments etc at https://ghauto.tech/2098/#comments. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *