I'm creating web tests in Selenium using MSTest and want to take a screenshot everytime a test fails but I don't want to take one every time a test passes.
What I wanted to do is put a screenshot function inside the [TestCleanup]
method and run it if test failed but not if test passed. But how do I figure out if a last test passed?
Currently I'm doing bool = false
on [TestInitialize]
and bool = true
if test runs through.
But I don't think that's a very good solution.
So basically I'm looking for a way to detect if last test true/false when doing [TestCleanup]
.