Issue
I am using NUnit to test a large web application with Selenium.
We are depending on a number of exceptions, either custom or provided by Selenium, to fail the tests. NUnit features a Retry
attribute, which repeats a failed test, but only on an explicit assertion error.
Is there any way to handle exceptions as failed assertions by default? Wrapping every relevant statement, or every test as a whole in
Assert.That(TestMethodDelegate, Throws.Nothing)
as suggested here would involve a lot of work and additional boilerplate.
I understand this goes against intended behavior, but I need to bend some rules to tame the misguided nightmare that is Selenium testing.
Solution
You could take the code from the NUnit RetryAttribute and write your own version for your tests. I believe you would just need to modify the if statement in the Execute
method to check for failures and errors.
Answered By - Rob Prouse
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.