Note: Henrik, thanks for releasing 3.1.2 and fixing the window size issue, it is working perfectly now!
I have been using JDK 8 because it is the only version that I can successfully run Test FX tests with. If I run it using JDK 7 (latest release 51, early adopter 60, previous version 45, 25 or 6) I get the following error...
java.lang.RuntimeException: Unable to show stage
at org.loadui.testfx.GuiTest.showNodeInStage(GuiTest.java:119)
at org.loadui.testfx.GuiTest.showNodeInStage(GuiTest.java:103)
at org.loadui.testfx.GuiTest.setupStage(GuiTest.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.util.concurrent.TimeoutException: Timeout waiting for task.
at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:276)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:96)
at org.loadui.testfx.GuiTest.showNodeInStage(GuiTest.java:114)
... 28 more
...however, if I have any version of JDK 8 installed, it works fine. My issue is that I am trying to get code coverage into our build and ideally I would like to use the out of the box jacoco plugin for gradle. For some reason, jacoco (and other code coverage plugins I tried) don't play so nice with Test FX and Java 8. Since Test FX was designed for Java 7, I was hoping to rollback to a Java 7 version to more easily get code coverage integrated. Is anyone else having trouble even running simply tests in Java 7? I am trying to run this simple test below and I am getting the error above...
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.loadui.testfx.GuiTest;
import org.loadui.testfx.categories.TestFX;
import static org.loadui.testfx.Assertions.verifyThat;
import static org.loadui.testfx.controls.Commons.hasText;
@Category(TestFX.class)
public class SimpleButtonTest extends GuiTest {
@Override
protected Parent getRootNode() {
final Button btn = new Button();
btn.setId("btn");
btn.setText("Hello World");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
btn.setText( "was clicked" );
}
});
return btn;
}
@Test
public void shouldClickButton(){
final Button button = find( "#btn" );
click(button);
verifyThat( "#btn", hasText("was clicked") );
}
}
...any thoughts? Can you run this simple test in Java 7? Thanks!