Boosting code coverage via white-box tests

One major difference compared to the tests we wrote in the previous section is that the new set of tests will live in the same package as the package we are testing. To differentiate from the black-box tests that we authored previously and hint to other engineers perusing the test code that these are internal tests, we will place the new tests in a file named retail_internal_test.go.

Now, it's time to pull the curtain back and examine the implementation details of the retail package! The public API of the package is always a good place to begin our exploratory work. An effective strategy would be to identify each exported function and then (mentally) follow its call-graph to locate other candidate ...

Get Hands-On Software Engineering with Golang now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.