A Look at What’s New with dbUnit Release 2.6.0
dbUnit is a mature, free, open-source Java framework for automated testing with databases. It is particularly useful with integration tests for SQL, Hibernate and other ORM entities, and acceptance tests (round-trip/whole application testing) for an application. Some of the dbUnit features include:
- Pre-populating databases with data stored in XML, CSV, and Excel files for a test (the “setup operation”)
- Validating actual table data against expected data after a test (the test runner)
- Cleaning up data after the test, restoring it to a known state for subsequent tests (the “teardown operation”)
My colleagues and I have used dbUnit for many years with our customer applications to improve the quality, save time, and keep it in a known good state. The dbUnit team made me a committer many years ago as I was a frequent user and contributor.
New Release = New dbUnit Improvements
dbUnit 2.6.0 was just released and features a number of improvements and a major new feature: ValueComparers.
Prior to release 2.6.0, dbUnit had data validation using equality – verifying that actual data equals expected data. ValueComparers enable data validation using any formula, not just equality, including simple ones such as greater than and complex ones such as depending on the contents of another column.
This new feature greatly expands the data validation capability, overcoming previous comparison limitations with data types such as IDs and dates.
For further information on the new release and existing features, the dbUnit website has a number of resources:
- The dbUnit Changes Report has the main release details
- The new ValueComparer feature has these dbUnit doc pages, including code examples:
Founded in 1991, Intertech delivers technology training and software development consulting to Fortune 500, Government and Leading Technology institutions. Learn more about us. Whether you are a developer interested in working for a company that invests in its employees or a company looking to partner with a team of technology leaders who provide solutions, mentor staff and add true business value, we’d like to meet you.