You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently using the 4.1.0 version of Extent Report
Create MSTest Class with 2 Test Methods
Added the below code. Extent report is getting generated in the destination folder, but not with the name provided.
Actual: I gave ReportName: Extent.html to get created, but its creating index.html
Expected: It should create the report as per name provided [ Extent.html ]
using System;
using System.Threading;
using AventStack.ExtentReports;
using AventStack.ExtentReports.Reporter;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace AutomationReporting
{
[TestClass]
public class UnitTest1
{
//Extent Reports
public static ExtentReports _extentReports;
public static ExtentTest test;
public TestContext TestContext { get; set; }
[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
Console.WriteLine("ClassInitialize");
string reportPath = "C:\\TestResults" + "\\Reports\\Extent.html";
ExtentHtmlReporter _extentHtmlReporter = new ExtentHtmlReporter(reportPath);
_extentHtmlReporter.Config.ReportName = "Extent.html";
_extentReports = new ExtentReports();
_extentReports.AttachReporter(_extentHtmlReporter);
_extentReports.AddSystemInfo("Environment", "Dev");
_extentReports.AddSystemInfo("Tester", "Vishnu");
_extentReports.AddSystemInfo("Machine", "Local Laptop");
}
[TestInitialize]
public void TestSetUp()
{
test = _extentReports.CreateTest(TestContext.TestName);
test.Log(Status.Info, TestContext.TestName + " test started");
}
[TestMethod]
public void Adding()
{
test.Log(Status.Info, "StepLogsGeneration-1");
int a = 1;
int b = 2;
Assert.AreEqual(3, a + b, "Addition is failing");
Thread.Sleep(1000);
}
[TestMethod]
public void Subtracting()
{
test.Log(Status.Info, "StepLogsGeneration-2");
int a = 1;
int b = 2;
Assert.AreEqual(1, a - b, "Subtraction is failing");
Thread.Sleep(1000);
}
[TestCleanup]
public void TestCleanUp()
{
if (TestContext.CurrentTestOutcome.ToString() == "Passed")
{
test.Log(Status.Info, TestContext.TestName + " test Finished");
}
else
{
test.Fail(TestContext.TestName + " test Finished");
}
}
[ClassCleanup]
public static void ClassCleanup()
{
_extentReports.Flush();
}
}
}
In the destination folder this is what its creating
Its a small issue, but if its fixed it would be a great product to continue.
The text was updated successfully, but these errors were encountered:
This is a bug currently in the newest version of extent reports..
If you use ExtentV3HtmlReporter then it works, like in this example: var htmlreporter = new ExtentV3HtmlReporter(ExtentReportPath + "Data" + DateTime.Now.ToString("MMM-dd-yyyy hh-mm-ss") + ".html");
But Visual Studio will give you a warning that ExtentV3HtmlReporter is outdated.
The newest one is called ExtentHtmlReporter without the V3. But with this one, the output files name is always "index.html"
Just add the V3 to your example code, then it will work. Im curious if this nuget package ever will be fixed tho.
Currently using the 4.1.0 version of Extent Report
Create MSTest Class with 2 Test Methods
Added the below code. Extent report is getting generated in the destination folder, but not with the name provided.
Actual: I gave ReportName: Extent.html to get created, but its creating index.html
Expected: It should create the report as per name provided [ Extent.html ]
using System;
using System.Threading;
using AventStack.ExtentReports;
using AventStack.ExtentReports.Reporter;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace AutomationReporting
{
[TestClass]
public class UnitTest1
{
//Extent Reports
public static ExtentReports _extentReports;
public static ExtentTest test;
}
In the destination folder this is what its creating
Its a small issue, but if its fixed it would be a great product to continue.
The text was updated successfully, but these errors were encountered: