I am working on a test library using NUnit, and am generating a custom report while the tests run.
In the TearDown
of my tests I call a method that will report the result of the test. It works just fine if the test passes, but is never reached if the test fails, is ignored, or inconclusive.
To make things more difficult, the "//do stuff" in the TearDown
can also cause the test to fail in which case it would still need to be logged. BUT Assert
throws an exception which means it leaves the block and never reaches the reporting code.
[SetUp]
public void ExampleSetup()
{
//whatever
}
[Test]
public void ExampleTest()
{
//whatever
}
[TearDown]
public void ExampleTearDown()
{
//do stuff
someObject.ReportTestResult();
}
More Info - Using NUnit 3.2.0
Aucun commentaire:
Enregistrer un commentaire