We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Setting up data driven tests with Java tools by Andres Almiray
Learn how to set up effective data-driven tests using Java tools like Test Containers and DBUnit. Discover best practices for database testing, including Oracle Free and multi-format data testing.
- Test Containers allows running real databases in containers for testing, eliminating the need for in-memory databases like H2
- DBUnit helps with managing test data sets and comparing expected vs actual database state
- The Oracle Database Free edition (version 23.ai) can be used for development, testing and production at no cost
- Database Writer extension simplifies testing by working closer to the database level, reducing framework dependencies
- Test containers can be used with multiple languages/frameworks - not just Java but also .NET, Go, Python etc.
- Use Maven verify instead of install for running tests - it’s the proper lifecycle phase
- Test container startup is fast (around 10 seconds) and containers are ephemeral
- Multiple database formats (relational, JSON, graph) can be tested within the same database engine
- XML data sets can be used to define test data and expected results
- Framework knowledge is transferable between Spring Boot, Quarkus, Micronaut etc. - base concepts remain similar despite syntax differences