Gray Bar, not Green, in Eclipse JUnit View

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

Gray Bar, not Green, in Eclipse JUnit View

Postby deisner » Wed Mar 23, 2011 9:30 am

I'm still getting my feet wet with Windows Tester Pro. I have a simple toy app, which you can find here: http://pastebin.com/6wmpZk83. It has two text fields. The user types text in one, and the other field gets updated with an all-caps version of that text.

I've created a JUnit test for the toy app using Windows Tester. The test runs to completion with no errors or failures, and it tells me "Runs: 1/1". But the green bar I normally see, indicating a successful JUnit test run, is instead a gray bar:

Image

Here is the full test:

Code: Select all
package david.playground;

import com.windowtester.runtime.swing.locator.LabeledTextLocator;
import com.windowtester.runtime.swing.UITestCaseSwing;
import com.windowtester.runtime.IUIContext;
import com.windowtester.runtime.swing.locator.JButtonLocator;

public class WindowsTesterAppTest extends UITestCaseSwing {

    /**
     * Create an Instance
     */
    public WindowsTesterAppTest() {
        super(david.playground.WindowsTesterApp.class);
    }

    /**
     * Main test method.
     */
    public void testWindowsTesterApp() throws Exception {
        IUIContext ui = getUI();
        ui.click(new LabeledTextLocator("Enter Text: "));
        ui.enterText("Four Score");
        assertCapsified( ui);
        ui.click(new JButtonLocator("Exit"));
    }

    protected void assertCapsified( IUIContext ui) throws Exception {
        ui.assertThat(
                new LabeledTextLocator( "ALL YOUR TEXT: ")
                    .hasText( "FOUR SCORE"));
    }
}


This is with Eclipse Helios SR2, and Windows Tester 6.0.0.

Am I missing something? Thanks.

-David
deisner
 
Posts: 11
Joined: Wed Feb 16, 2011 11:48 am

Re: Gray Bar, not Green, in Eclipse JUnit View

Postby deisner » Wed Mar 30, 2011 6:11 am

OK, how about this, then: Am I the only one having this problem?
deisner
 
Posts: 11
Joined: Wed Feb 16, 2011 11:48 am

Re: Gray Bar, not Green, in Eclipse JUnit View

Postby keertip » Wed Mar 30, 2011 8:13 am

Comment out the line

Code: Select all
ui.click(new JButtonLocator("Exit"));


and then run the test.
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am

Re: Gray Bar, not Green, in Eclipse JUnit View

Postby deisner » Thu Mar 31, 2011 6:50 am

Thanks! That fixed it. If I can bother you further: why did it fix it? Should I never call anything that calls System.exit() in my tests?
deisner
 
Posts: 11
Joined: Wed Feb 16, 2011 11:48 am

Re: Gray Bar, not Green, in Eclipse JUnit View

Postby keertip » Thu Mar 31, 2011 10:38 am

Glad that solved the problem. The exit statement in the test closes the application, and then after the test is done, the test framework also tries to close the application. But it can't, since it is no longer there and this causes the grey bar.
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest

cron