In this chapter, we have discussed testing strategies for a microservice. Testing a microservice requires a high level of confidence in it. In the microservice architecture, an application has many more moving parts in comparison to others.
Unit testing tests the smallest piece of a microservice to determine if its behavior is as expected. Integration testing tests external dependencies and their communication methods between components, either externally or internally. Component testing verifies a microservice behavior in isolation from any external dependencies, whereas contract testing tests interactions at the boundary of an external service. End-to-end testing verifies the whole system, and this should ultimately meet the expected business goal.
In Chapter 8, Performance Testing of Microservices, we'll discuss the microservice approach to designing performance...