1

I am looking for scope of DBUnit TestCase. Can Spring DAO Layer methods be tested using using DBUnit? My perception is that JUnit should be used for Spring DAO Layer test cases. DBUnit test cases scope would be to verify Database Table Structure and Master Table Data. Can anything else be covered in DBUnit Framework Test cases?

1 Answers1

1

Can Spring DAO Layer methods be tested using using DBUnit?

Yes

My perception is that JUnit should be used for Spring DAO Layer test cases. DBUnit test cases scope would be to verify Database Table Structure and Master Table Data.

dbUnit is a JUnit test extension. Not sure why you think of dbUnit this way. It can verify tables contain data but that's to verify a CRUD operation.

Can anything else be covered in DBUnit Framework Test cases?

Yes, lots. Use dbUnit to test all DAO CRUD operations:

C: dbUnit verifies correct table contents from the insert(s) (having correct field contents) and cleans table(s) afterwards

R: dbUnit seeds the data for the query test and cleans table(s) afterwards

U: dbUnit seeds the data for the update test, verifies correct table contents for the update(s) (having correct updated field values), and cleans table(s) afterwards

D: dbUnit seeds the data for the delete test, verifies correct table contents from the delete(s) (rows no longer exist), and cleans table(s) afterwards

Jeff
  • 956
  • 8
  • 10