The Data Problem
Explore strategies for managing test data in Java applications, focusing on minimizing intertest dependencies, handling integration tests with databases, and maintaining fast, reliable JUnit tests through proper data management and test isolation.
We'll cover the following...
We'll cover the following...
Fast test
We still want the vast majority of our JUnit tests to be fast. This shouldn’t be a problem. If we isolate all of our persistence interaction to one place in the system, we end up with a reasonably small amount of code that must be integration-tested.
In-memory database
We might be tempted to consider using an in-memory database such as H2 to emulate our production database for testing purposes. This would help us get the speed we want, but otherwise can be a mess. Attempts we’ve made to use in-memory databases ...