In an event-driven architecture, the microservices are often integrated using the pubsub (publisher-subscriber) model and connected to each other by messaging platforms such as Kafka, RabbitMQ, etc. Typically a microservice in event-driven architecture acts either as producer/consumer or both.

In this post, we will see what to have in component tests for an event-driven microservice. But before that, we will understand what component testing is and how it’s different from unit testing.

What Do I Mean by Component?

Anything! A group of multiple units working together to accomplish a sub-journey of a longer user journey of the microservices lifecycle. Example:

A longer end-to-end journey:

Login > Compose a mail > Send it > Check the status in sent mail > Logout.

Different components of the longer journey:

Login > Compose a mail > Send a mail > Check the status in sent mail > Login > Logout > etc.

In a microservices architecture, a service itself can be considered as a component.

#microservice #testing

Component Testing for Event-Driven Microservice
2.90 GEEK