DEV Community

Discussion on: Learn Go by writing tests: Mocking

 
quii profile image
Chris James

Static typing certainly removes a lot of the tests you would need in a dynamic language but you still benefit from tests

I allude to this in the book in various chapters about how you should favour testing behaviour over implementation detail. It's a myth that unit testing means "tests on classes/functions/whatever" You write unit tests on behaviour, that could be a class which has a number of internal collaborators. You dont have to test them. In fact by testing them you may harm your efforts if you wish to change the implementation (refactoring)

i plan to do a talk/blog on this subject in more detail... sometime when i get the time.