I’ve created a POM framework utilizing NUnit in C#. I’ve created Reporting.cs file which creates reviews for the take a look at in that class. How I can generate reviews for all checks in numerous courses with out rewriting the reporting code.
BaseTest
- References
- package deal
- config
- initiatives
|- project_name
|- pages
|- checks
|- utils
|- reporting.cs
In checks folder information with TestLoginModule.cs have features
[Test]
public void TestFirst()
{
// take a look at code
}
[Test]
public void TestSecond()
{
// take a look at code
}
In checks folder information with TestDashboardModule.cs have features
[Test]
public void TestThird()
{
// take a look at code
}
[Test]
public void TestFourth()
{
// take a look at code
}
In Reporting.cs file
[OneTimeSetUp]
public void BeforeClass()
{
// create a take a look at report listing and fasten reporter
extent = new ExtentReports();
var dir = AppDomain.CurrentDomain.BaseDirectory.Substitute("/bin/Debug","");
DirectoryInfo di = Listing.CreateDirectory(dir + "//Test_Execution_Reports");
var htmlReporter = new ExtentHtmlReporter(dir + "//Test_Execution_Reports" + "//Automation_Report" + ".html");
extent.AttachReporter(htmlReporter);
}
[TearDown]
public void AfterTest()
{
var standing = TestContext.CurrentContext.Consequence.Final result.Standing;
var stacktrace = "" + TestContext.CurrentContext.Consequence.StackTrace + "";
var errorMessage = TestContext.CurrentContext.Consequence.Message;
Standing logstatus;
swap(standing)
{
case TestStatus.Failed:
logstatus = Standing.Fail;
take a look at.Log(logstatus, "Take a look at ended with" + logstatus + "-" + errorMessage);
take a look at.Log(logstatus, "screenshot");
break;
case TestStatus.Skipped:
logstatus = Standing.Skip;
break;
default:
logstatus = Standing.Cross;
break;
}
SB.Driver.Shut();
SB.Driver.Give up();
}
[OneTimeTearDown]
public void AfterClass()
{
extent.Flush();
}
I wish to name Reporting.cs OneTimeSetUp and TearDown after each Take a look at in numerous information