Test failed catch all - Resharper Test runner
Hi guys,
My current need is a way to have a method that will run when a test failed that had context of the failure.
something like
[FailureTearDown]
public void OnFailed(/* possibly */ object TestFixture, object TestMethod)
{
}
Right now my best approach has been to listen to the UnhandledException event in the app domain, e.g.
(in my test fixture constructor I have the following)
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += UnhandledExceptionHandler;
This is not working, I'm assuming that the test harness get's this exception event first, and closes the app domain under test. Though I cannot confirm this, all I know is my handler is not being called.
Anyone have any ideas?
I'm trying to avoid decorating every test with a try catch, these are UI tests and on failure I need to take a screenshot..
John
Please sign in to leave a comment.