What We Just Learned
Testing applications that use databases can be difficult. You have to make sure each scenario starts with a clean slate, but cleaning the slate can have its own pitfalls. In this chapter, we learned about the benefits and drawbacks of two strategies—transaction and truncation. To sum it up:
-
Liquibase is great for creating and evolving database schema.
-
ActiveJDBC is a useful library for quickly connecting to SQL databases.
-
Resetting state between scenarios is vital; otherwise, you get weird failures.
-
Transaction-based cleaning is preferred because it is fast, but it works only when there is one single-threaded process.
-
Truncation-based cleaning is a slower, brute-force technique that works in multiprocess and multithreaded ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access