问题
so I've worked with Extent Reports several times in the past versions (Since 2.0 upwards) and I was able to generate a single html report after tests were executed, same happened on version 3.0 until version 4.0 which generates dashboard.html and index.html.
From a Business perspective it is a bit weird having two report files... am I missing something on my code, or is that the new Standard of the Reporting stuff?
Single report file is generated on both versions 2.X and 3.X of ExtentReports For both Java/C#
Attached you can see the actual code I'm using on version 3.1 to get a single file report
_extent = new ExtentReports();
var dir = AppDomain.CurrentDomain.BaseDirectory.Replace("\\bin\\Debug", "");
DirectoryInfo di = Directory.CreateDirectory(dir + "\\Test_Execution_Reports");
var htmlReporter = new ExtentHtmlReporter(@"C:\testR\AutoReport.html");
htmlReporter.LoadConfig("C:\\testR\\ReportConfig.xml");
_extent.AddSystemInfo("Environment", "Test Report");
_extent.AddSystemInfo("User Name", "Test User");
_extent.AttachReporter(htmlReporter);
回答1:
Following resolved the issue.
I was previously using
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(reportPath);
in v4 I am using the following (basically this creates v3 style report on v4)
ExtentV3HtmlReporter htmlReporter = new ExtentV3HtmlReporter(reportPath);
so please replace ExtentHtmlReporter with ExtentV3HtmlReporter
var htmlReporter = new ExtentV3HtmlReporter (@"C:\testR\AutoReport.html");
来源:https://stackoverflow.com/questions/57097328/extent-reports-generating-two-html-reports