Not Using JUnit TestSuites

I’d never been really excited about setting up TestSuite classes like the classic AllTests in JUnit, but today I ran across an alternative. From a podcast at SwampCast, Jim Moore talks about a best practice being avoiding writing TestSuites.

Obviously they’re a bit of a pain and can be problematic to maintain, but often you need to break up at least the easy to run tests from the ones that are dependent on an actual database connection or a web GUI being up and running in a container. So you end up with something like GuiTestSuite that you only run with Cruisecontrol. Moore’s suggestion is to try to never write TestSuites. Simply use introspection in the various IDEs or in ant’s


task with the


tag. In order to avoid running dependent tests put them in another package like:


So if you have say some functional tests that run against say the actual web interface like JWebUnit you only run them if you include this package.