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 | ||
|---|---|---|
7 comments Saturday 28 Apr 2007 | Developer Testing, JUnit
7 Responses to “3 steps to running GWT JUnit tests in Eclipse”
[...] 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 [...]
Hi, I followed these steps to the letter and when I execute the test, I get an AssertionFailedError that No Test found in com….
even though I verified the path is correct, the class is correct and I do have a simpleTest() method that asserts some silly equality statement.
Idease?
Maybe you are running the test via JUnit 4 — it is probably looking for a @Test annotation.
J. D. – try renaming the method to “testEquality”.
[...] – bookmarked by 3 members originally found by WolfJounin on 2009-04-11 The Disco Blog " Blog Archive " 3 steps to running GWT JUnit tests… http://thediscoblog.com/2007/04/28/3-steps-to-running-gwt-junit-tests-in-eclipse/ – bookmarked by [...]
This is Very Useful article for ever. I am doing a bit on research about JUnit and i found also macrotesting http://www.macrotesting.com to be very good source for JUnit.
Regards,
Dinesh
Also make sure “test” folder is included in the build path.