|
|
|
|
|
by switchbak
1675 days ago
|
|
For real _unit_ tests? I would argue it's still a good distinction. We use an embedded postgres in our DB tests, and we call those 'Integration Tests' and run them separately than the pure unit tests. While still tremendously valuable, they do take a bit longer to run, and currently aren't written to allow parallel tests running. We've had a typical habit of writing most tests that hit the DB. Since applying a bit more discipline to remove the DB requirement, we've found it's a more pleasant experience with the quicker feedback loop in place. Your last point is a good one - tests that can run in isolation and are agnostic to the presence of other data (and ideally clean up after themselves) tend to be handy. |
|
If your running system speaks to the DB in parallel and handles pre-existing data, why wouldn't you want your tests to do the same?