bosseyu - 2010-02-02

Currently, automatic screenshot is taken when there is a com.thoughtworks.selenium.SeleniumException, for example the button user trying to click is not available in the page.

However, the automatic screenshot is not taken if the test case is failed due to an assertion failure, for example:
assertTrue(selenium.isTextPresent("logged in successfully!"));

or in case of a timeout:
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("mainContent")) break; } catch (Exception e) {}
Thread.sleep(1000);
}

My question is: how to always get automatic screenshot whenever the test case is failed no matter how it is failed?

Thanks!