10
Testing
Testing is one of the fundamental aspects of software development. You can decide to write tests before the code (test-driven development, or TDD) or after the code, but you have to write tests of your code to ensure your project remains maintainable as it grows. The Go team knows that. That is why the Go language incorporates a testing tool into the Go distribution.
Go comes with everything you need to write tests for your code, but it doesn’t stop there. There are also a lot of other testing tools and libraries provided by the ecosystem, such as testify for assertions, gomock for mocking, and testcontainers-go for integration testing.
In this chapter, we will cover how you test your Go API using the three main types of testing, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access