A case for not clearing the database between automated tests, arguing that persistent test data offers speed gains, more realistic data shapes, and easier test parallelism. The author explains the required mindset shift: tests must assert only on data they create rather than assuming an empty database. Advantages include faster test runs (no teardown overhead), gradual accumulation of realistic and 'naughty' data that can surface real bugs, and simpler parallelization since tests don't need full isolation. Disadvantages include harder debugging and occasional precondition clashes, both of which can be mitigated by temporarily switching to a clean database when needed.

9m read timeFrom calpaterson.com
Post cover image
Table of contents
The required mentality changeThe advantagesDisadvantages (and some mitigations)How far I've gottenContact/etc

Sort: