Don’t mock Databases, just run them with Docker

Benjamin Cane
Jun 15, 2020 · 9 min read
Photo by Oxa Roxa on Unsplash

I see this one question pop up in channels over and over again.

“What is the best way to mock a database for unit tests?”

For most, the thought of mocking responses from a database is daunting. Taking each DB call and creating a unique mock response can be a lot of work, especially within a large service.