Achieve 100% Coverage of the Unit Test Method Code in the GoLang

Sangramsing Kayte
12 min readFeb 29, 2024

When using a Go unit test method, it is necessary to make certain that each and every line of code contained within the function that is being tested is performed at least once during the course of the test in order to get complete coverage of the code. Mocking, table-driven tests, and subtests are some of the approaches to testing that can be utilized in conjunction with one another to accomplish this goal. First, a broad strategy would be

--

--

Sangramsing Kayte

I am a Machine Learning Scientist with over 9+ years of experience in both the Industrial and Research & Development domain.