We've recently been doing a little work in Swing, and being the pervasive testers that we are, this means doing some Swing UI tests.
We played with a few Swing UI testing frameworks briefly, and settled on Fest, for now. (Incidentally, Swing UI testing frameworks are typically inactive projects with inactive communities and not nearly as mature as web UI testing frameworks or non-UI java testing frameworks).
In order to get these tests running on our build / continuous integration server, we needed a solution to run Swing tests on a headless server. One of my colleagues had previously used VNC for this purpose, so we quickly adapted that approach to the build.
I've only just realized that this same approach can be used to hide the UI test run from the main X Windows session, so that you can continue to use your windowing environment without having windows popping up, appearing and disappearing, and otherwise making it difficult to work.
Accordingly, I've done the following:
This is an immense improvement. Now we can run our UI tests without interrupting the rest of our workflow.
sudo apt-get install vncserver
DISPLAY=:2 mvn clean test