I have a test class that has several tests and all pass. If I add the class to a test suite, all tests fail.
The reason for that is that dependencies to JavaFX types cannot be resolved. I use a test rule that initializes the JavaFX framework (e.g. the application thread etc.) and this seems to work fine as the passed tests indicate. The tests fail due to an exception:
java.lang.NoClassDefFoundError: Could not initialize class javafx.scene.control.Label
Why does JUnit behave differently depending on how I run tests? How can I fix this? Note that this is not in particular a GUI test per so (I do not want to simulate user actions or something like this, it is more about how certain controls are created and managed internally by my code).
Test suite:
@RunWith(Suite.class)
@SuiteClasses({
TestClass.class
})
public class TestSuite {
}