Once we have done unit and integration testing for all functions of the modules within a microservice, we need to test each microservice in isolation. A distributed system might be composed of a number of microservices. So, when it comes to testing a microservice in isolation, we have to create a mock of other microservices. Consider the following diagram on component-testing a microservice:
Component testing involves testing the interaction of a microservice with its dependencies, such as a database, all as one unit.
Component testing tests the separation of a component from a large system. A component is a well defined and encapsulated part of a large system, which can be independently replaced. Consequently, testing such components in an isolated system provides many benefits, such as the separation of concern among components of the application, as well...