Set my RCP application to a certain state

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

Set my RCP application to a certain state

Postby pwwamicke » Thu Sep 18, 2008 5:57 am

Can I use Window Tester to set our RCP application to a certain state for further manual testing?
During development before I can record new test cases. I need to do manual testing of new features until they are stable enough to be completely recorded.
For our application that means to connect to a database, open a component, do some settings - it is tedious - only then the testing of new code can start.
So I would like to use Window Tester to record the repeating steps. Then being able to replay this inside the Eclipse IDE, and after finishing that take over control manually.

Can I achieve this?

Thanks and Regards,
Paul
pwwamicke
 
Posts: 1
Joined: Thu Sep 18, 2008 5:30 am

Re: Set my RCP application to a certain state

Postby Phil Quitslund » Tue Sep 23, 2008 7:56 pm

Hi Paul,

This is a REALLY interesting use case. To get at an answer, we have to explore a little how the test runner works. Specifically, the test runner takes control and tears down the application once the last test has finished executing. To get your desired result, you could simply write a test that does not complete (any time soon)... In other words something like this:

Code: Select all
private static final int REALLY_LONG_TIME = 6000000; //NOTE: in milliseconds

public void testSetUpApp() throws Exception {
   doAppSetup();
   getUI().pause(REALLY_LONG_TIME);
}


Once doAppSetup() completes, the test thread will sleep for a REALLY_LONG_TIME. While it's asleep, the UI thread will be live and you can safely interact with the application.

Would this fit the bill? Let us know how this idea works for you and we can see about refining it.

Thanks for the inquiry!
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Re: Set my RCP application to a certain state

Postby dif » Thu Oct 16, 2008 12:30 am

Hi,

for our RCP application I must to manual testing too...and I have the same problem with bringing the application in a certain state.
I tried your code, and sometimes it works but sometimes the AUT freezes. I know that JUNIT doesn't guarantee the ORDER in which the test-methods are run, therefore, it could happen that my testWaitReallyLongTime-method is beeing executed before the STATE is reached.
Am I right?
What I did next is:
1. refactored IUIContext from main test method as data member called "ui" in the test-class. Initialized it in main test method via getUI().
2. defined a method waitReallyLongtime (without the "test" prefix) and called inside it ui.pause()
the result was that it still got blocked .

Pls help me with this or send me a link where these things are explained.

Regards,
Diana.
dif
 
Posts: 6
Joined: Wed Oct 15, 2008 5:58 am

Re: Set my RCP application to a certain state

Postby Phil Quitslund » Fri Oct 17, 2008 8:45 am

While I wouldn't necessarily recommend this, you can order tests if you build a suite. For instance,try running the OrderedTest suite:

Code: Select all
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class OrderedTest {


   public static class T1 extends TestCase /* or UITestCaseSWT */ {
      public T1(String name) {
         super(name);
      }
      public void testT1_A() throws Exception {
         System.out.println("T1.testT1_A()");
      }
      public void testT1_B() throws Exception {
         System.out.println("T1.testT1_B()");
      }
   }
   
   public static class T2 extends TestCase /* or UITestCaseSWT */ {
      public T2(String name) {
         super(name);
      }
      public void testT2_A() throws Exception {
         System.out.println("T2.testT2_A()");
      }
      public void testT2_B() throws Exception {
         System.out.println("T2.testT2_B()");
      }
   }
   
   public static Test suite() {
      TestSuite suite = new TestSuite("Ordered Test Example");
      suite.addTest(new T2("testT2_A"));
      suite.addTest(new T2("testT2_B"));
      suite.addTest(new T1("testT1_A"));
      suite.addTest(new T1("testT1_B"));
      return suite;
   }
}


As for your app freezing in a pause() call, I wouldn't expect that... Do you happen to have any condition or shell handlers registered? If there's a handler or condition that's blocking the UI thread we might see this. To dig deeper, we should probably inspect a thread dump at the time of the freeze.
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest