how do I test app exit with jemmy

601 Views Asked by At

I use Jemmy for Java GUI testing. Is it possible to test closing application?

Currently I simulate a click on the exit button (causing System.exit(0)) and the test fails:

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)

Thanks, Andrey

2

There are 2 best solutions below

0
On

You could potentially override security manager and check that System.exit() is going to happen.

Java: How to test methods that call System.exit()?

0
On

You could try to do it with an Action from the File menu and Exit.

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