Write useful JUnit test suites

Wednesday, 25 August 2004

Structure your JUnit test suites to simplify unit testing — you can easily run all your tests with one command.

In every package directory, create a test suite called AllTests, containing all TestCases in that directory. For example: com.zikzak.widget.util.AllTests (This can be generated automatically by the Eclipse IDE.)

Create a global test suite, e.g. com.zikzak.widget.AllTestsGlobal, and add all new AllTests classes to its suite() method. This way you will be able to run every single JUnit test with a single command, just by running the global test suite.

Tags:

Share this page:
  • Twitter
  • Digg
  • Slashdot
  • del.icio.us
  • Google Bookmarks
  • DZone
  • LinkedIn
  • Reddit
  • Facebook
  • Print

Leave a comment