Supplementing unit tests with integration tests
Unit tests are small, fast tests that verify the behavior of a single component. In Go, the UUT is typically the package, which exposes an API that these fast tests can verify against. These independent units combine to make up components, which are identifiable parts of a system. Usually, components have well-defined responsibilities and provide a group of related functions. A component’s units work together to deliver the component’s functionality.
Engineers rely heavily on unit tests in the development phase, and they are an important pillar of TDD, where the testing practice requires the testing code to be written together with the implementation code. However, they have some limitations that make the remaining tests of the testing pyramid essential. Therefore, as TDD practitioners, we cannot simply focus on unit tests.
Limitations of unit testing
The practice of verifying functionality with unit tests has...