Creating a JUnit JDBC Test Fixture

A test fixture is a set of objects, having known values, that provide data for the test cases. A JDBC test fixture provides code that establishes a database connection for the test cases to use.

To create a JUnit JDBC test fixture 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 JDBC Test Fixture.
  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, add code that initializes test fixture objects to the setUp() method, and add code that releases any resources they acquire to the tearDown() method.


Creating a JUnit Test for a Generic Java Project
Creating a JUnit Custom Test Fixture
Creating a JUnit Test Case
Creating a JUnit Test Suite