We do something similar, in our case, we're using some condition so that we do not close the main window.
private void closeAllShells() throws Exception { SWTBotShell[] shells = bot.shells(); for (SWTBotShell shell : shells) { if (!isEclipseShell(shell)) { shell.close(); } } } -- Ketan On 09-Oct-08, at 2:33 PM, Richard Adams wrote: > > At the end of each test method you need to remember not to leave any > dialogs active, so that the next test can begin 'clean'. > > I've added this code to the tearDown() method in my tests which > closes all dialogs open except for the first(which is the application > shell). > > public void tearDown () throws Exception() { > for (int i = bot.shells().length -1; i>0; i--){ > bot.shells()[i].close(); > } > } > > It seems to work well with our increasing number of RCP app tests - > hope it's useful. > > > -- > Dr Richard Adams > Senior Software Developer, > Computational Systems Biology Group, > University of Edinburgh > Tel: 0131 650 8281 > email : [EMAIL PROTECTED] ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ SWTBot-users mailing list SWTBot-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/swtbot-users http://swtbot.org/ - a functional testing tool for SWT/Eclipse