On projects with end-to-end tests that drive the GUI, it is awkward to run the tests on a developer workstation because the GUI automation driver interferes with the desktop. It moves the mouse, steals focus away from apps we want to use, and can start typing text into the wrong application if we switch to another app during a test run.
On Linux we’ve solved this by running the application under test on a virtual X server (xvfb or xnest). With xnest we can watch the tests running but still use the real desktop without interference.
Is there anything equivalent for Windows?
I found a freeware program called “RunProcess.exe” written by Frank P. Westlake that can run a process bound to the desktop of a non-interactive (e.g. off-screen) WindowStation. However, there is no source.
Therefore I’ve implemented my own version (simpler than Frank Westlake’s) with Java and JNA. It’s in the Window Licker repository in the tools module. The class is called
com.objogate.wl.win32.RunOnDesktop. At some point I may port it to C and make it a normal command-line .exe, or maybe turn it into an Ant task for running tests off-screen.