6

I need to know how to integrate/merge multiple extent reports into one single dashboard report.

I have multiple modules in my project.If I run for single module I will get report in my target folder.In case If I want for multiple modules how to show one single html report in extent which fetches all the module reports in one single dashboard.

Anyone who has worked on this can some shed some light on this.

  • what kind of report generating module you are using? What format your reports are in? – Yu Zhang Jul 31 '17 at 8:09
  • The format of reports are in html.Zhang .All are maven projects. – Pradeep Jul 31 '17 at 9:54
  • some info at softwaretestingmaterial.com/generate-extent-reports may help – Michael Durrant Jul 31 '17 at 9:57
  • Is this using TestNG ? – Michael Durrant Jul 31 '17 at 9:59
  • hi Michael I have gone through this link. Thnx . Here I need to know how to merge multiple extent reports instead of segregation.I am using Junit with Selenium web driver – Pradeep Jul 31 '17 at 10:01
1

you can use the below code. just pass 'false' as parameter this will not replace your previous report with new one and in the end you will get the merged report for all the scripts

public ExtentReports(String filePath, Boolean replaceExisting)
 {
      this(filePath, replaceExisting, null, null, null); 
}
public  ExtentReports extent= new ExtentReports(filePath, false);
1

In your extent reporter class, specify the code as:

ExtentReports extent = new ExtentReports("Specify the file path here where your extent reports should reside",false);

Parameter False - Is used to append the reports of previous run testcase along with newly run testcase.

Parameter True- Deletes the history of reports of previous run testcases and shows only the reports of newly run testcases.

  • Hi Shanila,I have already tried this.Moreover false will append the report irrespective of time .I mean if you would have ran report today and again if you run tomorrow it will append both the reports into one instead of creating a new one for next day's report.We need to write custom logic for my requirement.I am trying it out .Anyways thanks for your suggestion. – Pradeep Nov 8 '17 at 6:51
1

Try this :

https://github.com/anshooarora/extentreports-java/blob/master/src/test/java/com/aventstack/extentreports/common/ExtentManager.java

This approach is called as singleton approach and setting the flag to true you can able to generate the Single report(appending to existing report).

0

The problem that you are facing is because every time the test is running it is making a new instance of the extent report and you have different reports for different test cases.

You can define the extent reports and extent test as static - where you are initializing the path of the extent report, do it before the suite. And where you are flushing the extent report do it after the suite.

public static ExtentTest Reportlogger;
public static ExtentReports extent;
0
htmlReporter.setAppendExisting(true) line will help to merge different reports together and create one final report

ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(OUTPUT_FOLDER + FILE_NAME + ".html");
        htmlReporter.setAppendExisting(true);
        htmlReporter.config().setDocumentTitle(reportName + " Automation Report");
        htmlReporter.config().setReportName(buildName + " Test Report");

        htmlReporter.config().setTestViewChartLocation(ChartLocation.BOTTOM);
        htmlReporter.config().setTheme(Theme.DARK);
        htmlReporter.setAppendExisting(true);

        extent = new ExtentReports();
        extent.attachReporter(htmlReporter);
        extent.setReportUsesManualConfiguration(true);
  • Can you explain how or why this helps OP? – trashpanda Dec 4 '18 at 8:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.