Tips for Go — BDD Testing, Mocking, and Coverage Analysis

Weiyuan
5 min readFeb 15, 2021
TLDR — the code for getting the above coverage can be found here

Writing unit tests in Go ain’t the easiest thing to start with.

Note that I didn’t say that it’s hard to write unit tests in Go. Rather, the “vanilla” test tools may not represent the most intuitive usages, to begin with. However, if you know where to look, it is possible to write effective and understandable tests for your Go applications. It’s even possible to…

--

--

Weiyuan

Senior Engineering Manager, Ascenda Loyalty | Former Engineering Manager, Grab | Former Director of Engineering, ZilLearn | bit.ly/weiyuan