From: Jean-Francois P. <jfp...@ya...> - 2006-04-23 01:20:24
|
Hello, Actually I don't have any problem any more. But I just want to write what has been a nightmare for me for the past week, so that others can avoid the same issue. My application quits through a call to System.exit (yes I know it it not good practice, but I will not change it now, I also believe that many people still use this practice in their Swing applications). When using costello to record/replay scripts, I had no problems. However, when I wanted to use JUnit with Ant to run my GUI tests, problems had started. That was very strange: ant would launch my GUI tests (I could them performed up to the end) but at the end, no report was generated! At the beginning I thought it was a classpath problem, so I investigated in this direction but could find nothing! Then I used Eclipse debugger and discovered that the application (ant's JUnitTestRunner.main) was exitting in a prematurate way! Since I was suspecting Eclipse debugger to have an impact on the results, I then used jdb (!!!) to further debug the problem in command-line. The strange thing was that once my application would call System.exit, the abbot's NoExitSecurityManager would catch it and throw an exception, BUT right after it the exit was still performed! Then I mrembered having read somewhere (in abbot Mailing List) something like "System.exit in the AWT thread is evil". So I decided to check that point immediately by putting the call to System.exit into a Thread (just for checking): that solved the problem! So my conclusion is: Don't call System.exit() from the AWT Event Dispatch Thread! If you cannot afford -like me- to quit your application in a clean way (ie without System.exit), then call System.exit but ensure that, if you are in the AWT Thread, you create and start another Thread that would call System.exit. Note: besides problems with Abbot/JUnit/Ant, I don't know if System.exit from the AWT Thread has other issues, can someone comment on that? Cheers Jean-Francois ___________________________________________________________________________ Faites de Yahoo! votre page d'accueil sur le web pour retrouver directement vos services préférés : vérifiez vos nouveaux mails, lancez vos recherches et suivez l'actualité en temps réel. Rendez-vous sur http://fr.yahoo.com/set |