The Cult of Go Test

submited by
Style Pass
2021-05-29 07:00:03

A favourite test helper library, with some simple test assertion functions clearly has some value. But this post puts forward some useable concrete arguments why they are normally just not worth it.

After five years with Go and the last three in a (now) 100% Go team I’ve worked with around 30 Go developers - not a huge amount, but not insignificant. The one thing that new people to the team challenge most is the lack of their favorite test helpers. People generally are OK that we don’t need a whole framework, but the small simple assertions? Why are they so bad?

This came up again recently and as I prepared to put forward the case against assert libs a learned colleague reminded me that this is still a case of bike-shedding. So if like us you have bigger problems, park this, and focus on them. However I’m putting pen to paper so I can point people at it in future, and it may help others. At first this recent tweet from @KentBeck first felt relevant:

Don't spend more time discussing a reversible change than it would take to make (& potentially reverse) the change— Kent Beck (@KentBeck) October 31, 2016

Leave a Comment