Report name issue.
Hi,
the ExtentManager.cs class has the private static ExtentHtmlReporter getHtmlReporter() method which instantiates the htmlReporter = new ExtentHtmlReporter(ReportLocation);
The ReportLocation is a string path to the location and name of the report. Ex: D:\Projects\MyProject\ExtentReports\my_report_name_dd-MM-yyyy.html.
This worked perfectly on version 2, but after upgrading to v4 the html report is created with the name index.html instead of the name I give it. Ex: D:\Projects\MyProject\ExtentReports\index.html
Also there are two distinct html files created, index.html and dashboard.html, instead of a single report file.
How can this issue be solved? I need to give my report a specific name.
Thank you.
can you specify the exact version and the .net framework version you are using?
NET 4.7.2 ExtentReports 4.0.2 and 4.0.3 both have the same behavior.
@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();
^ With that being said and with version-4 reporters, instead of specifying the file name, you now need to specify the directory name with your timestamps and all files will be created likewise.
So, there's no way to change the file name of the report?
So, there's no way to change the file name of the report?
While there is no way to rename this file directly from Extent library, I renamed this file using this simple piece of code.
System.IO.File.Move(oldNameFullPath, newNameFullPath);
This solved my purpose. Hope this helps.
Hi @jaideep-dhumal Where to use this line of code? When i put in [AfterTestRun] it doesnt works?
I have written this line of code after publishing result to Extent file.
Example:
extent.Flush(); if (!File.Exists(newNameFullPath)) { File.Move(oldNameFullPath, newNameFullPath); }
Hope this helps.