May 9, 2020

21 tips to write better go tests

I have found the following tips to be generally useful in writing and working with go unit tests. They are not in any particular order: Use “t.Helper()" method to reduce the amount of noise in error reports. By calling the method a function is marked as a test helper function. Write a table-driven unit test. In most cases, this is a logical approach. Each table entry has a set of input and expected result(s). Read more

© Habtom Giorgis 2019