Test Tools and Methods Service Levels / DAO in Java

I am trying to find the best ways to test service levels and DAO. So a few questions ...

  • When testing a service level, is it best to test against the DAO level or β€œlive” DAO layer specified in the test environment?
  • How to test SQL at the DAO level when a single test database is in a shared environment (Oracle / DB2)
  • How do you solve the paradox of any DAO entries / updates that need to be tested with a DAO read that also needs to be verified?

I am looking for any good documentation, articles or links in this area, as well as any tools to help automate the process. I already know about JUint for unit testing and Hudson for CI.

+5
source share
2 answers

Get Growing Object-Oriented Software Guided by Tests . It has some useful tips on how to check access to the database.

Personally, I usually break DAO tests in 2, a unit test with a database for testing DAO functionality and an integration test for checking database queries. If your DAO only has a database access code, you won’t need a unit test.

, , , () . , , , insert. - ( FK), , .

, dbunit, , , , - , . , Test Data Builder .

dbmigrate, , .

, , / . "" , .

+4

:

  • DAO . , . EasyMock Mockito .
  • . : . DBUnit .
  • , ( ), , . ad-hoc- DBUnit , , . , , . , .
+3

All Articles