I really feel like sharing this with the world, because it has been an excruciating pain in the butt to get these to work.
Anyone having downloaded a GWT package for Linux might have noticed that it includes the Mozilla browser — it seems that GWT needs a browser to run its tests, and while on a Windows machine it can safely assume IE is installed, on Linux it cannot. Hence the browser in the package. As of GWT 1.4.61, you need the following Linux-specific stuff (in addition to any other which is platform-independent) on your classpath to run GWT tests on a Linux machine:
- gwt-dev-linux.jar;
- the mozilla-* directory;
- all libswt-*.so Linux shared libraries;
- mozilla-hosted-browser.conf
All this comes with the package, but there are many things you don't need (e.g. docs), so it's your call whether to choose the needed files or just put the whole bunch on your classpath.
If you have troubles when running GWT unit tests with Ant, like, for example, a "[junit] Tests FAILED (crashed)" message, you might want to turn output on to see the details (by switching the showoutput attribute of the junit task to "true") — I had this off for quite a while, and it turned out that GWT had been outputting a message that I didn't see |
GWT doesn't support 64-bit libraries yet, so forget about running those tests on a 64-bit Linux machine (we tried this on siil — believe me, you don't want to). Period.
There's another pitfall while executing GWT tests on a dedicated Linux server. GWT requires a display (don't ask) to be registered, thus while you will be safe with a workstation which does have a display by default, it's not the same with a server machine. Thus we have to emulate this behaviour, with an easy and efficient way of doing this being executing the following lines before launching the Ant target:
Xvfb :1 -ac -screen 0 1024x768x8 & export DISPLAY=:1
For those who don't know what Xvfb is about, here's a link.
So if you're running CruiseControl, a good idea might be to put these lines in your cruisecontrol.sh file (don't forget to kill the Xvfb process if you shut CruiseControl down).
That's all, folks ©
Happy testing.
I must say I am surprised to see people using indirect conversion of integers to strings. Not only it looks bad to me, but simple tests show that it's inefficient.
In short: use Integer.toString(int), for God's sake!