Throwing a runtime exception in a fixture does not force the tests to fail

30 views
Skip to first unread message

neeraj kumar

unread,
Aug 21, 2012, 3:05:54 AM8/21/12
to guiceber...@googlegroups.com
I have written a fixture for one of the webdriver tests.

The issue is that I want the tests to fail if lets say, one of the post-processing steps fail (i.e code in the overridden stop() method throws an exception).
I catch all the exceptions thrown within the stop method and raise a RuntimeException with a specific error message, but this does not make the tests fail.

All it does is kills the thread on which the fixture was running and logs the errors/exceptions seen on that thread.
(I guess this thread is a non-deamon thread and hence exceptions thrown here do not reach the JVM)

What I would ideally want is that if such an occurrence happens then the tests/test suite should fail reporting this error.

Can someone point me in the direction of how this can be achieved.
Reply all
Reply to author
Forward
0 new messages