cucumber-jvm: how to use the same window instance across all the tests

397 views Asked by At

I am using cucumber-jvm with groovy and fest to test a Swing application.

Every time a scenario is run the main window app is created (and destroyed at the end).

How can I avoid it? How can I run the same instance of the window across all the features?

1

There are 1 answers

0
Liviu Gro On

Fest needs to be in the same Java process as the main window app, so the cucumber-jvm stuff that calls Fest methods in the steps definitions is in the same process. After the cucumber scenario finishes it calls System.exit() that stops that java process that cucumber is in (and the process were the main app window is).

Just reimplement that part yourself so it does not call the System.exit() and it will not destroy it at the end.

(This is the class that you need to reimplement https://github.com/cucumber/cucumber-jvm/blob/master/core/src/main/java/cucumber/api/cli/Main.java)

Look @ Cucumber jvm seems to use System.exit