A Farewell To Mocks

One aspect of TDD I will probably avoid in 2018 is extensive use of mocks. It is a well-known pattern among Go programmers to provide interfaces for key bits of functionality, and then devising mock implementations to enable a portable testing environment.

Some reasons for avoiding this pattern from this point forward:

What's the alternative? Better crafted test environments. In our enterprise, that means Docker Compose. While Compose isn't perfect, it does let us build up a full environment in a portable fashion. The Compose environment carries with it it's own maintenance costs, but it is worth it to test against real databases, caches, orchestration tools, etc.

last update 2018-01-01