An increase in the number of microservices in a platform will increase the DevOps work exponentially. In this situation, automation will take the lead, bringing challenges in automation testing. Unlike in monolithic applications, it is not straightforward to test microservices. As microservices can receive API calls from many other microservices and make calls to other microservices, testing a microservice in isolation is tricky with integration testing. It requires a considerable amount of effort to plan microservice testing. In this chapter, we will go through some techniques that we can use to test a microservice.
We will cover the following topics in this chapter:
- The purpose of testing in the microservices world
- Unit tests
- Integration tests
- Component (service) tests
- Contract tests
- End-to-end tests