2011-08-17 65 views
1

我使用Jemmy進行Java GUI測試。是否可以測試關閉應用程序?我如何使用jemmy測試應用程序退出

目前我模擬的退出按鈕點擊(導致System.exit(0))和測試失敗:

junit.framework.AssertionFailedError: Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit. 
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:154) 

感謝, 安德烈

+0

可能重複(http://stackoverflow.com/questions/6141252/dealing-with-system-exit0-in-junit-tests) – Pops

+0

您可能想要嘗試在[此問題]的答案中描述的SecurityManager方法(http://stackoverflow.com/questions/6141252/dealing-with-system-exit0-in-junit-tests)。 – bkimminich

回答

0

你可以嘗試從文件菜單和退出的行動來做到這一點。 [在JUnit測試(0)與System.exit處理]的

 Action action = new Action("File|Exit", null); 
     action.perform();