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 packages, as well as third-party packages, that are designed to make writing tests more streamlined.