Microservice Testing Strategies

Introduction

Microservices are distributed in nature, in any architecture there can be many microservices involved. There are various components involved in any microservice like service can consume events from ActiveMQ or a Kafka topic, saves the data in the Database (both RDBMS or NoSQL) in one go, and then produce the new enriched event to another Kafka topic for other services to consume and start its processing or invoking altogether a separate RESTful service. Writing meaningful test cases in the architecture is not straightforward. The article focuses on a possible testing strategy for cleanly separating the various test cases in the application.

Testing Strategy

Consider a Pyramid having three layers L1, L2, and L3. The first layer of the Pyramid is L1, the second one is L2 and the third one is L3, any microservice architecture should have three different types of Test cases categorized as L1, L2, L3, these layers are just for our visualization don’t try to create packages for each one of them, let’s understand them in detail.