I create web tests in Selenium using MSTest and want to take a screenshot every time the test fails, but I do not want to take it every time the test passes.
I would like to take a screenshot function inside the [TestCleanup] method and run it if the test failed, but the test failed. But how do I know if the last test passed?
I am currently doing bool = false on [TestInitialize] and bool = true if the test passes.
But I do not think this is a very good solution.
So basically, I'm looking for a way to determine if the last test is true / false when executing [TestCleanup] .
selenium webdriver mstest
Martin mussmann
source share