3

I'm just getting started with a project that combines GWT, Google App Engine and the Google Eclipse plugin. Where is the best place to store my tests? I normally keep my code organized Maven-style, with src/main/java, and tests in src/test/java. The default setup I get from the plugin dumped my source directly into src, which I'm not too fond of, but I'd prefer not to fight against the tools. What's the "standard" place to put unit tests in such a project?

Solution:

  • create src/main/java, move the existing code under there
  • create src/test/java, add your tests here
  • go to Project -> Properties -> Java Build Path, add the new locations as Source Folders.
George Armhold
  • 30,824
  • 50
  • 153
  • 232

2 Answers2

4

I've faced a kind of problem woth GAE testing: Some tests require an appengine-testing.jar wich conflicts with the main appengine-api-xxx.jar of the poject. That way, I was able to run tests for GAE but it conflicted with a normal run/debug launch. To be able to run the app in my local machine, I had to remove the appengine-testing.jar and then, a lot of compilation errors appeared in my test/ clases.

If you want an advice, set your test clases in another project (where you can use the jars without conflict)

Otherwise, if you got make it work, please, tell me how did you do.

Thanks a lot.

Magus
  • 41
  • 1
3

Put it where it pains you least.

GWT on Google App Engine is pretty new at this point; you are optimistic to expect there is a "standard" place, especially since you've already found an inconsistency in what the tools do.

Since you've already accepted the source starting at "src/", why not put the test source in "test/"? This is certainly standard in many contexts.

Glenn
  • 6,455
  • 4
  • 33
  • 42