Unit and Integration Testing
Testing is an integral part of any development process. Writing good tests helps ensure that any changes made throughout the development process will keep the code working and reliable. Testing is especially important in microservice development: it’s not enough to test each service; you also need to test integrations between the services, ensuring every service can work with the others.
In this chapter, we will cover both unit testing and integration testing and illustrate how to add tests to the microservices we created in the previous chapters. We will cover the following topics:
- Go testing overview
- Unit tests
- Integration tests
- Testing best practices
You will learn how to write unit and integration tests in Go, how to use the mocking technique, and how to organize the testing code for your microservices. This knowledge will help you to build more reliable services.
Let’s proceed to an overview...