On 10-Oct-08, at 12:47 AM, Hans Schwaebli wrote:

> That does not work great, it freezes:
>
> import org.eclipse.swt.examples.addressbook.AddressBook;
> import org.junit.Test;
>
> public class BlaTest {
>     @Test
>     public void me() {
>         AddressBook.main(null);
>         // freezes after previous statement
>         // so no SWTBot statements can be run after the GUI started
>     }
> }


This is bound to freeze as you correctly pointed out.

The only way I see this work is to start the application in a method  
annotated as @Before and make that the super class of all your classes:

public class BaseTest {
   private static boolean  initialized  = false;
   @BeforeClass
   public static void startApplication() {
     if (!initialized)
       startApplication();
     initialized = true;
   }
}

You can then make BlaTest extend from BaseTest

-- Ketan


-------------------------------------------------------------------------
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

Reply via email to