Testing Your Way Out of Microservices Hell
A microservices architecture offers the fantastic promise of loosely coupled systems, independently testable and deployable. However, it can also present some significant challenges while conducting integration & exploratory testing. Since a single service will often not do anything valuable without several collaborator services, one typically needs to understand the way many services work together to effectively integration-test the system. This challenge can be viewed optimistically as well. By design, a microservice must at least provide some API interface, often making it easy to create imposter services for its collaborators. Injecting a test double into the system is often as simple as setting a few configuration flags. It also offers flexibility in the scope of our tests. We can make some choices as to what services, middleware, and databases should be considered “under test,” and which should be considered “outside dependencies.” This then enables us to fine tune the scope of any single test to as tight or as wide as we would like. In this talk, we’ll discuss some of the challenges when testing microservices, as well as some approaches to overcome them. We’ll emphasize the importance of standardization and conventions, and how our desire to test in this way can make sure everyone adheres to these design standards.