extent-framework / extentreports-csharp

Extent Reporting Library, .NET
http://extentreports.com
Apache License 2.0
50 stars 40 forks source link

How to generate the multiple extent reports for different browsers with different report name? #162

Closed shubautomation closed 1 year ago

shubautomation commented 1 year ago

Hi Team, @anshooarora @namilkimfree

I want to generate the multiple extent reports for different browsers. For example, in Azure pipeline if I run for Chrome then name of the report should be TestReport_Chrome.html and same fro different browsers.

I am also not able to change the name of the report. It is default to index.html

Can you please suggest me how we can change the name of the report to our customise name?

anshooarora commented 1 year ago

You can attach any number of reporters to ExtentReports:

var firefoxReport = new ExtentSparkReporter("firefox.html");
var chromeReport = new ExtentSparkReporter("chrome.html");
extent.AttachReporter(firefoxReport, chromeReport);

// somewhere in your hooks (pseudo-code)
if (test.hasTag("firefox")) {
  firefoxReport.log();
} else {
  chromeReport.log();
}

As you can see, if the number of conditions increase, it can become a little difficult to maintain this structure. It's probably better to use tags and filter them on the UI:

_extent.CreateTest("Test").AssignCategory("firefox");
_extent.CreateTest("Test").AssignCategory("chrome");