Creating a JUnit Test Suite

A test suite is an application that invokes test cases.

The main() method of the test suite class indirectly passes itself to a JUnit runner. The default behavior of the JUnit Test Suite Wizard is to insert a call to a TestRunner class, which opens a dialog window to display the test results. Edit this method if you wish to use a different test runner.

The suite() method creates a TestSuite instance and adds the test cases to it. Edit this method if you wish to add or remove test cases.

To create a JUnit test case class:

  1. In the Navigator, select the project.
  2. Choose File | New to open the New Gallery.
  3. In the Categories tree, expand General and select Unit Tests (JUnit).
  4. In the Items list, double-click Test Suite.
  5. Complete the wizard to create the test fixture class. For more information at any time, press F1 or click Help from within the dialog.

    The class created by the wizard will be opened for editing.

  6. Modify the file as needed. In particular:


junit.framework.TestSuite

Creating a JUnit Test for a Generic Java Project
Creating a JUnit Test Suite

Creating a JUnit Custom Test Fixture
Running a JUnit Test