extent-framework / extentreports-csharp

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

ExtentHtmlReporter can't create the report.html #103

Closed bly1201 closed 4 years ago

bly1201 commented 4 years ago

Hello All, Please help!! I try to use the ExtentHtmlReporter to create a costume report name like "MyReport.html" but it generate an "index.html" file instead. By the way I'm using ExtentReports 4.1.0. and C# in VS 2019. Here is my code

            //var htmlReporter = new ExtentHtmlReporter("C:\\DevEnvironment\\MyReport.html");
           var htmlReporter = new ExtentHtmlReporter(@"C:\DevEnvironment\MyReport.html");
            htmlReporter.Config.Theme = Theme.Standard;
            htmlReporter.Config.DocumentTitle = "My Test Report";
            htmlReporter.Config.ReportName = "Positive and Negative Test";
            _extent.AddSystemInfo("Environment", "OS Widows");
            _extent.AddSystemInfo("User Name", "Qlee");
            _extent.AttachReporter(htmlReporter);

Thanks for your help.

bly1201 commented 4 years ago

@dod0o This is the expected behavior with the version4 HtmlReporter. It creates upto 4 files depending upon the attributes that are created. This is also true for all new version4 reporters, to maximize performance and obviously to keep each file focused on its specific tasks.

If you would like the old behavior, use the version3 port of HtmlReporter:

var v3html = new ExtentV3HtmlReporter()

Overclock303 commented 4 years ago

You can use the single and free-named old system with Version 4 HtmlReporter like this : reporter = new ExtentHtmlReporter(path,ViewStyle.SPA);

Note that ViewStyle is a new feature of V4 reporter. No need to switch to the old V3 library like @bly1201 said.