I am running some UI tests using WebDriver and MSpec. I added a check in Cleanup that no JavaScript errors were raised. But, throwing an exception in here doesn't fail the tests. How can I get this to work? I need to fail any test, and don't really want to do this separately in each test.

有帮助吗?

解决方案

If I remember correctly, there isn't really a way to do this in a cleanup. Cleanups happen after tests, so it would be too late to fail them. As a matter of principle, it may be better to write the assertion for it not raising any javascript errors as its own spec at the end of each of them.

其他提示

Even if it can be done from the Cleanup code, it should not be done that way. Reason: How would you know which of the multiple tests that you have failed?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top