Unit testing

By definition, a unit is the smallest possible bit of code that we can test. In the context of Go programming, this would typically be a single function. However, according to the SOLID design principles that we explored in the previous chapters, each Go package could also be construed as an independent unit and tested as such.

The term unit testing refers to the process of testing each unit of an application in isolation to verify that its behavior conforms to a particular set of specifications.

In this section, we will dive into the different methodologies of unit testing at our disposal (black- versus white-box testing). We will also examine strategies for making our code easier to unit test and cover the built-in Go testing ...

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.