使用TestFX的测试用例出现错误

时间:2018-10-11 07:15:21

标签: testfx

class ApplicationLauncherTest extends ApplicationTest {

    ApplicationLauncher myapp = new ApplicationLauncher();

     @Before
     public void setupClass() throws Exception {
         ApplicationTest.launch(ApplicationLauncher.class);
        }

     @After
     public void tearDown () throws Exception {
         FxToolkit.hideStage();
         release(new KeyCode[]{});
         release(new MouseButton[]{});

     }
      @Test
      public void clicksButtons() throws Exception {
          clickOn("#register");
       }
    @Override
    public void start(javafx.stage.Stage primaryStage) throws Exception {
        primaryStage.setTitle("Image Capture");
        BorderPane mainWindow = new BorderPane ();
        primaryStage.setScene(new Scene(mainWindow));
        primaryStage.setHeight(600);
        primaryStage.setWidth(600);
        primaryStage.centerOnScreen();
        primaryStage.show();
    }

}

请帮助我更正代码。我对TestFX非常陌生,没有太多可用的示例。

0 个答案:

没有答案