问题
In my project, we are using FEST for GUI testing. We have been persuaded that FEST is powerful, however displaying frames every time is a waste of time. Also we are using continuum and FEST doesn't work with continuum because continuum's maven can't open the GUI (by the way we use maven too and our tests pass in maven on our local machine).
How can I solve this problem?
If it is not possible, please inform me.
回答1:
FEST by design displays the UI. If you don't want the tests to block your desktop, the only way is to use some kind of virtual desktop: - Xvfb (Linux) - VMWare (Linux, Windows) - Auto-logon (Windows - not tested, found somewhere in docs)
You can read more about it here: http://docs.codehaus.org/display/FEST/Continuous+Integration
May or may not be related, but in order to speed up your tests have a look at:
Robot.settings().delayBetweenEvents()
This controls how fast mouse and keyboard events are.
回答2:
You can use the Cacio-tta module of Caciocavallo... I know it sounds like I'm talking about cheese, but it's a real project:
http://openjdk.java.net/projects/caciocavallo/
The testing framework consist of a runner that plugs into Fest ("CacioFESTRunner") and allows you to run the test without disrupting your normal flow, you don't need any special server, since cacio has all that is needed.
It is also fully synchronous, so you don't need to worry about spurious failures due to drawing command being dispatched asynchronously, and it is available as a maven package so it is very easy to setup.
You can find more info here:
http://jroller.com/neugens/entry/caciocavallo_1_1_released
回答3:
Have a look at WindowLicker:
A framework for the test-driven development of Java systems through the GUI.
I haven't used it myself, but it's written by some of the same people that wrote JMock, so it should be a good quality utility.
来源:https://stackoverflow.com/questions/2320409/how-to-make-gui-test-without-displaying-in-fest-swing