Tag: testfx

TornadoFX与TestFX在每个TestCase之后关闭视图

我正在尝试使用testfx框架测试基本的登录屏幕(使用tornadofx创建)。 我添加了3个运行良好的测试用例,但问题是他们使用前一个阶段而不是创建一个新的测试用例。 我希望测试用例能够独立运行。 我正在测试一个View()而不是一个App()。 如果我使用MyMainApp()。start(stage)然后MyMainApp()。stop(),我得到所需的行为。 但是如何为Views和Fragments做到这一点。 以下是代码: class LoginScreenFeatureTest : ApplicationTest() { override fun init() { FxToolkit.registerStage { Stage() } } override fun start(stage: Stage) { LoginScreen().openWindow() //MyMainApp().start(stage) } override fun stop() { FxToolkit.cleanupStages() //FxToolkit.toolkitContext().registeredStage.close() //MyMainApp().stop() } @Test fun should_contain_button() { // expect: verifyThat("#submitBut", hasText("SUBMIT")) } @Test fun should_click_on_button_and_pass_login() { //init //Why do I always […]