让FEST等待应用程序加载 [英] Making FEST to wait for the application to load

查看:98
本文介绍了让FEST等待应用程序加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不熟悉基于FEST的GUI测试.

I am new to FEST based GUI Testing.

MyFrame是我的应用程序的根类.

MyFrame is the root class for my application.

 @Before    
      public void onSetUp() {

        MyFrame frame = GuiActionRunner.execute(new GuiQuery<MyFrame>() {
            protected MyFrame executeInEDT() {
              return new MyFrame();  
            }
        });

        frame2 = new FrameFixture(robot(), frame);

        frame2.show(); // shows the frame to test
      }

我运行测试用例时,

@Test public void testGui()
      {
          String rs = frame2.label("hl").text().toString();
                  assertTrue(rs.equals("First")); 
      }

上述方法不会打印标签中出现的实际字符串.

The above method doesn't print the actual string present in the label.

我认为FEST API没有等待应用程序加载.

I think the FEST API is not waiting for the application to load.

是否有任何方法可以推迟GUI元素查找?

Is there any methods available to postpone the GUI element lookup ?

推荐答案

//do your clicks
fixture.robot.waitForIdle();//give the GUI time to update
//do your asserts

这将暂停您的代码,直到您的GUI没什么可更新的为止. Pause的优点是,不必花很长的时间间隔等待更长的时间.

this will pause your Code until your GUI has nothing left to update. The advantage to Pause is, that you do not have to wait longer than you need by passing a to large time interval.

这篇关于让FEST等待应用程序加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆