How to prevent running AfterTest method if there is any exception in testmethod?
public class TestAttribute : Attribute, ITestAction
{
public void BeforeTest(TestDetails testDetails)
{
// Run before test
// ....
}
public void AfterTest(TestDetails testDetails)
{
// don't run it if there is any exception
// how to check whether an exception is thrown from Nunit
// ...
}
public ActionTargets Targets { get; private set; }
}
[Test][TestAttribute]
public void TestMthod()
{
throw new Exception("test exception");
}
Is there a way to know if an exception is thrown in AfterTest method?
Aucun commentaire:
Enregistrer un commentaire