News for hackers. Stuff that matters.
Re:If All You Have Is a Database, Everything Looks Like a Nail by GordonS on Tuesday December 08, 2020 @04:07AM (#25343319)
> this is IMO outdated terminology, and in my experience not modern practice. It's super easy now-days to swap in a local lightweight database like sqlite which is 99.9% compatible with your production database, and use this for even tiny unit tests.

I actually see it as more "modern" to use an actual database.

I've been around long enough to have seen trends going from database -> mocks -> fake -> back to databases again!

Mocking is fine for some cases, as are fakes (e.g. lightweight SQLite wrapper you mention), but for anything non-trivial, such solutions often have "blind spots" - such as foreign keys, or unsupported data types. At the same time Docker was becoming a thing, I (and others) were growing tired of seeing issues related to these limitations.

At some point, it pays to have integration tests that just hit a real database. And with Docker, you can do that trivially - it takes only a few seconds to spin up and populate a fresh Postgres instance. I haven't looked back since.

Re:If All You Have Is a Database, Everything Looks Like a Nail by jerven on Tuesday December 08, 2020 @05:03AM (#25343587)
https://www.testcontainers.org/modules/databases/ is brilliant for this in the JVM world.