DEV Community

Discussion on: Writing Tests in Go

Collapse
 
goncalorodrigues profile image
Gonçalo Rodrigues

Great introduction to testing in Go!

One thing I have struggled with in the past is the balance between unit tests and end to end tests.
Unit tests usually feel too tightly coupled with the implementation and need to be constantly changed. And because they don't test integrations between the components I still find that most of the potential bugs go untested.
End to end on the other hand are amazing. I find that they catch a lot of errors. It's impossible to test everything though as they end up being quite slow and you get an explosion of input parameters combinations.

So I end up writing a lot of end to end tests and just unit test the critical parts of my code.

Collapse
 
jpoly1219 profile image
Jacob Kim

Yeah, it does become a bit tedious to change my unit tests every time I make some modifications to my code. I'm trying out different testing methodologies at the moment, and your method seems like it could save a lot of time.