Sagar Jani
Sagar Jani

Reputation: 161

Extent Reports: Unable to generate reports for multiple suites.

I am executing selenium-automation for 4 suites as follows:

<suite name="allSuites">
  <suite-files>
    <suite-file path="suite1.xml" />
    <suite-file path="suite2.xml" />
    <suite-file path="suite3.xml" />
    <suite-file path="suite4.xml" />
  </suite-files>
</suite>

I am creating the report-name as follows: "extent-report-current-date-time.html"

But when I execute this suite I see the extent report for the first suite.

Also the extent reports documentation states that :

"The ExtentReports report client for starting reporters and building reports. For most applications, you should have one ExtentReports instance for the entire JVM."

Is this the reason why I am getting only one report?

My ExtentManager class:

extent = new ExtentReports();
htmlReporter = new ExtentHtmlReporter(getReportName(config));
ClassLoader classLoader = ExtentReportService.class.getClassLoader();
        File extentConfigFile = new File(classLoader.getResource("extent-config.xml").getFile());
htmlReporter.loadXMLConfig(extentConfigFile);
htmlReporter.setAppendExisting(true);
extent.attachReporter(htmlReporter);
extent.setSystemInfo("Environment", config.getAutomationServer());

Is there a turnaround for this issue? Or should I execute my test cases one by one?

Upvotes: 1

Views: 1318

Answers (1)

Sagar Jani
Sagar Jani

Reputation: 161

Found a workable solution meeting my ends.

My single suite looks like:

<suite>
 <parameter1>
 <parameter2>
 <test>
   <classes>
   </classes>
 </test>
<suite>

I was using the same classes for all my suites (which may not be necessary). And I came across the concept of "Assign Categories" in Extent Reports. So I set my parameters at <test> level instead at <suite> level. And instead of multiple suites, I created one single suite.

Upvotes: 1

Related Questions