jasonravagli / gym-manager

0 stars 0 forks source link

AssertJ Swing non-deterministic errors when using JDialog #13

Open jasonravagli opened 2 years ago

jasonravagli commented 2 years ago

AssertJ Swing occasionally raises ComponentLookup exceptions on Linux. The framework sometimes creates empty GUI hierarchies and the errors are not reproducible. This causes builds on GithubActions to fail even if all tests pass on local environments.

jasonravagli commented 2 years ago

Using JDialog is mandatory for this application since the main JFrame needs to wait that the dialogs to close before continuing the execution. It seems that the AssertJ Swing problems are related to modal JDialog opened and closed by the DialogFixture methods. We can try to avoid using modal dialogs in unit tests and let the JFrame set the modal state of the dialogs (the correct behavior will then be tested with integration tests).

jasonravagli commented 2 years ago

Problems on Ubuntu still persist. Other users encountered similar problems, but the solutions that they proposed did not work.

Also using a TightVNC environment to run the Maven build did not solve the problem.

We introduced a workaround using a JUnit Rule that retries to run failed tests until a maximum number of attempts is reached. This is not a definitive solution but tries to avoid the problem by exploiting its non-deterministic nature.