Pregunta

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.

¿Fue útil?

Solución

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.

Otros consejos

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?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top