Hi all,

I hope someone could help me out here. Here is my framework: I am running automation tests for web app, the language is Java, the testing framework is TestNG and I am using selenium to drive my web app. Since i am triyng to move on from a local machine running tests to a unattended nightly tests, I really need a way to gracefully recover from errors in the web app. Whether browser errors, or my web app errors I should be able to catch an error or exception, and handle it. This is easily done with the power of Java and the guarantee from TestNg and selenium that any unexpected behavior or error should raise exceptions. So a simple try catch block within the code should take care of these situations. What I am struggling with is when I get to the error recovery function, how can I get back to a known state if indeed the error is unrecoverable meaning that i will need to shut down the browser and restart a new section using a new selenium browser object.
So, if taking in considerations all the TestNG dependencies( ex. init, stop, dependsOnMethods, dependsOnGroups) how can I successfully restart the browser and get back to the next Test method, without the neeed to run all the tests that previously "passed" again and therefore losing all the time and information regarding the tests that run before the failed one.

Thanks for any help