views:

51

answers:

0

Try to use the FEST-Swing for Swing GUI testing, and using example from http://easytesting.org/swing/wiki/pmwiki.php?n=FEST-Swing.LaunchFromMain

Unfortunately the frame.isShowing() always return false though I already see the JavaApp Swing is running

See my codes

...
    ApplicationLauncher.application(JavaApp.class).start();
    GenericTypeMatcher<Frame> matcher = new GenericTypeMatcher<Frame>(Frame.class) {
        protected boolean isMatching(Frame frame) {
        System.out.println("title:" + frame.getTitle() + " showing:" +frame.isShowing()); // .getTitle());
            return "Java Application".equals(frame.getTitle()) && frame.isShowing();
        }
    };
    Robot robot = BasicRobot.robotWithNewAwtHierarchy();
    FrameFixture frame2 = WindowFinder.findFrame(matcher).withTimeout(5000).using(robot);
...

from the console log

title: showing: false

Two questions:
1. I have to use Frame insteaf of JFrame, otherwise it can't be matched, it cause the title is not correct, I expect "Java Application"
2. the frame.isShowing() is always returning false, it seems strange

BTW: lastest codes seems needs parameter for GenericTypeMatcher() rgs/larry