Chapter 11. Unit-testing database applications

This chapter covers

  • Unit-testing in isolation from the database with mock objects

  • Performing integration tests with Cactus and DbUnit

  • Improving integration tests’ performances

 

Dependency is the key problem in software development at all scales.... [E]liminating duplication in programs eliminates dependency.

 
 --Kent Beck, Test-Driven Development: By Example

For the combined 22 years that we have been writing business applications, we can’t recall a single project that did not use a database of some sort! How do people unit-test code that calls a database? Most of them don’t. Many developers deem the database problem to be too complex and rely solely on functional tests.

Our goal in this chapter is to show ...

Get JUnit in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.