How do you manage resource clean up in JUnit4 (in a JUnitRunner / in a TestCase) when you interrupt the test in debug mode ?
I use Selenium WebDriver by implementing JUnit tests. When I run the test in debug, if I interrupt the test by clicking on the stop button, then my navigator is still open. I would like to close this navigator by calling a method. But I don't know where calling this method. In fact, I've overrided BlockJUnit4ClassRunner to have my own Runner and I also have implemented a WebDriverTestCase. So I can do a lot of things.
I tried to implement my own SecurityManager and override the method checkExit(int status) but, when I interrupt my test in debug mode, the SecurityManager is not called (with a System.exit(), it works correctly).