Basic JUnit test for JavaFX 8
I use a Junit Rule to run unit tests on the JavaFX thread. The details are in this post. Just copy the class from that post and then add this field to your unit tests. @Rule public JavaFXThreadingRule javafxRule = new JavaFXThreadingRule(); This code works for both JavaFX 2 and JavaFX 8.