Unit test with heterogeneous database

  1. testing by re-creation of the database
  2. Using a data access layer (no database access into the mainstream code)
  3. Use "Transaction" !
  4. Use stubs/mocks for database (depend on 2)

NB: unit testing has to be fast (re-creation of database generally isn't) because you run the test suite after every minor modification

http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html

http://www.bennorthrop.com/Home/Blog/unit_testing_daos_and_database_code.php