Вопрос

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