Library to generate an HTML report based on log4net records during application or tests (NUnit) execution.
Please see log2html @ nuget.org for installation instructions.
At the beginning of application/tests execution global report configuration should be invoked:
var reportMetaData = new ReportMetaData
{
ReportName = "log2html.Test Execution Report",
ReportEnvironment = "DEV"
};
var report = new ReportImpl(
new ReportFile(new ReportTemplate(reportMetaData)),
new ReportEntryFactory(new NUnitTestCaseName()),
new NUnitTestStorage()
);
Report.Configure(report);
In the example above report HTML report folder location is specified:
Path.Combine(Directory.GetParent(baseDirectory).Parent.Parent.Parent.FullName, "Results")
which is located 3 parent folders up the folder tree related to \Bin\Debug
folder.
If the Debug folder location is C:\Projects\MySolution\MyProject.Tests\Bin\Debug
then the Results folder location will be C:\Projects\MySolution\Results
.
Additionally "browser" can be specified for tests which use Selenium WebDriver:
[Test]
public void TestAppend1()
{
new ReportContext(testCaseName, "FireFox");
...
}
Report.Pass("Hello World!");
To add browser screenshot (when using with Selenium WebDriver) to the report record an additional package log2html.Support should be installed.
Report.Info("Log with screenshot", new dnk.log2html.Support.WebDriver.Screenshot(webDriver));
Run pack-all.cmd 1.0.0.35
and upload symbols packages from pack
folder to https://www.nuget.org/packages/manage/upload