Headless Testing with TestFX

Posted on Mon 11 April 2016 in JavaFX, Testing

Jérome Cambon wrote a nice introduction to TestFX and how to enable the headless mode using Monocle.

I tried to reproduce the steps he described for running my TestFX GUI tests in headless mode from Eclipse so I can keep using my mouse while they are running. The crux is setting the VM arguments in Eclipse. First, I tried to set

-Dtestfx.robot=glass -Dglass.platform=Monocle -Dmonocle.platform=Headless -Dprism.order=sw

in the VM arguments section of the JRE tab in my Maven run configuration:

Maven run configuration in

This did not work. I could still see the TextFX robot move the mouse cursor on my screen.

I had to specify the VM arguments using Maven's 'argLine' parameter:

clean install -DargLine="-Dtestfx.robot=glass -Dglass.platform=Monocle -Dmonocle.platform=Headless -Dprism.order=sw"

Maven argLine

If anyone knows why setting the VM arguments in the run configuration did not work, please let me know.