Reputation: 1684
I have created coded UI tests and I want to close and reopen the application after a test fails. Right now I have my tests set up so that it runs the application in the beginning of all the tests because it takes a long time to open the application and I don't want or need it to open before every test only one of them. Right now however, if the application throws an error all of my other tests will fail when they shouldn't. Does anyone know of a way to run code after one of my tests fail?
Upvotes: 0
Views: 258
Reputation: 91
You can use TestContext.CurrentTestOutcome
property in the [TestCleanup]
method to determine the result of test execution.
You might want to move this [TestCleanup]
method to the parent class to make it reusable.
Upvotes: 2