I use this code to validate Failure in NUnit at end of test execution-
if (TestContext.CurrentContext.Result.Status == TestStatus.Failed)
{
do something
}
The issue I have is the Selenium NoSuchElement exception is not considered a Failure, hence when it reaches above code. The status is still PASSED. The way I handled it was adding Assert.Fail() in catch section of Selenium code to force the NUnit to fail. Is this right way of doing it or there is other ways? I am triggering NuNit tests from batch file