Getting Started
Finished dbUnit in 5 Minutes? Here’s where to go next.
Writing Tests
PrepAndExpectedTestCase is a turn-key prep/verify test case needing no parent class — dependency-inject it or instantiate it directly. Start here for most new tests.
For the full picture — composition (IDatabaseTester) vs. inheritance
(DBTestCase and its subclasses), and how to choose between them — see
Test Integration.
Preparing and Verifying Data
Datasets covers the dataset file formats (Flat XML, XML, CSV, YAML, Excel, and more) used for prep and expected data.
Data Comparisons covers verifying results:
equality comparison, ValueComparer-based comparison for cases plain
equality can’t handle (auto-incrementing ids, timestamps, tolerances), and
collecting every difference instead of failing on the first.
Configuring dbUnit
Connections & Configuration covers
IDatabaseConnection, DatabaseConfig properties/features, and
CachingConnectionProvider for connection reuse across test methods.
Database Operations covers INSERT, CLEAN_INSERT,
REFRESH, and the rest of the DatabaseOperation family used for test
setup/teardown.
Filters covers restricting which tables, columns, or rows participate in an operation or comparison.
Running dbUnit Outside JUnit
Ant Task covers running dbUnit operations from an Ant build, including a full Canoo WebTest walkthrough.
Using a Specific Database
Database-Specific Guides covers vendor-specific data types, quirks, and configuration for each of dbUnit’s 9 supported databases.


