I use AssertJ to test my swing application. I must to close my application after test and before the next test, which will start my application again. But, when I call frame.close();
or System.exit(0);
the test crashes with exit code 0. I tried to use this code before test:
ApplicationLauncher.application(App.class).start();
pause(8000);
frame = WindowFinder.findFrame(FrameMatcher.withTitle("Application")).using(robot());
try {
frame.close();
} catch (Exception e){
e.printStackTrace();
}
ApplicationLauncher.application(App.class).start();
pause(8000);
frame = WindowFinder.findFrame(FrameMatcher.withTitle("Application")).using(robot());
But, after frame.close();
I have the same problem. May be anyone know how to do it? Any advice?
As an answer I think is better to use bush scripting. I wrote bush script, that start one test from application and close it after testing line by line. I think it is the most simple to run testcase in new instance of application and close app after testing.
#!/bin/bash
echo "try to start test"
java -cp /home/gui-application.jar
app.gui.tests.runners.firsttestcase.RunFirstCase