4

Building Efficient Test Suites

In the previous chapter, we learned how to supplement the functionality of Go’s testing package with third-party libraries. These libraries make it easier to mock the dependencies of the Unit Under Test (UUT) and create assertions in these tests. Mocks are essential building blocks to being able to easily write test code for well-designed implementation code, according to the SOLID design principles.

In practice, developers identify edge cases of their requirements and implementations, ensuring a good code coverage percentage, which we discussed in Chapter 2, Unit Testing Essentials. In this chapter, we will learn how to create test suites.

One popular technique for constructing test suites in Go is table-driven ...

Get Test-Driven Development in Go 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.