Developer Component and System Testing with DbUnit
The open source DbUnit framework provides an elegant solution for controlling a database dependency within applications by allowing developers to manage the state of a database throughout a test. With DbUnit, a database can be seeded with a desired data set before a test; moreover, at the completion of the test, the database can be placed back into its pre-test state.
Most enterprise applications are constructed with a database in mind. Databases, however, create interesting dependency scenarios when it comes to effective white box testing. On one level, isolating application code with mock objects from a data store is an effective means of testing such code. Nevertheless, this level of code segregation is not always easy. Unit testing of EJB Entity beans is practically impossible without a container and an associated data store. Furthermore, applications using JDO-like frameworks also have slight difficulties in creating isolation levels without databases.
The open source DbUnit framework provides an elegant solution for controlling a database dependency within applications by allowing developers to manage the state of a database throughout a test. With DbUnit, a database can be seeded with a desired data set before a test; moreover, at the completion of the test, the database can be placed back into its pre-test state.
About Andrew Glover
Andrew is the Engineering Manager for Netflix's Delivery Engineering Team. He and his team are building the next generation Continuous Delivery platform that is facilitating Netflix's rapid global expansion. Before joining Netflix, he served as the CTO of App47, where he lead the development of a SaaS Mobile Application Management platform. Andrew is also the co-author of Addison Wesley's “Continuous Integration” and he actively blogs about software at thediscoblog.com.
More About Andrew »