3 steps to running GWT JUnit tests in Eclipse
One of the hippest things about Google’s Web Toolkit is that you can write JUnit tests that can verify asynchronous server side behaviors. What’s more, your copasetic JUnit tests can also be run via Eclipse (not to mention a build process like Ant, etc), which has the effect of decreasing the time between when you code a feature and when you can verify it actually works as expected.
In order to run your GWTTestCase classes in Eclipse, however, you need to do a few steps, otherwise, you’ll get a bunch of nasty things not found errors. Accordingly, to configure Eclipse’s bag to successfully run your JUnit tests, you need to do three things:
- Create a configuration profile via the Run menu item to launch your JUnit test. Because it’s my bag, I like to create an individual profile for each test, hence, you’ll need to have a fully qualified test class specified. Additionally, ensure the test runner is JUnit 3.

- In the Arguments tab, add
-Dgwt.args="-out www-test"to the VM arguments section.

- Lastly, in the Classpath tab, you’ll need to add a few User Entries– namely the directories where your source code and test code lives.

-
-
This is done by selecting the User Entries item and clicking the button labeled Advanced, then selecting the Add Folders option and then actually selecting the desired folder. It is actually quite easy.
-
After that, you’re good to go to run those JUnit GWT tests, man!
| Related odds and ends | ||
|---|---|---|
Saturday 28 Apr 2007 | Developer Testing, JUnit
[...] What s more, your copasetic JUnit tests can also be run via Eclipse (not to mention a build process like Ant, etc), which has the effect of decreasing the time between when you code a feature and when you can verify it actually works as … …Sportzia More [...]