Making FEST to wait for the application to load

房东的猫 提交于 2019-12-01 04:58:35

问题


I am new to FEST based GUI Testing.

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
      }

When I run the test case,

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

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

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


回答1:


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

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.




回答2:


Maybe you can use the pause method from org.fest.swing.timing.

Have a look here http://fest.easytesting.org/swing/apidocs/org/fest/swing/timing/Pause.html



来源:https://stackoverflow.com/questions/8803471/making-fest-to-wait-for-the-application-to-load

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!