In the past, testing a monolith, we could depend on the majority of our test domain being deployed together to simplify testing (particularly integration and end-to-end testing.) As we move to distributed deployments, it becomes harder and less effective to maintain the same approach to testing. Breaking up your testing to mirror how services are developed and deployed both presents some new challenges, but also new opportunities to improve testing. However, doing so requires new approaches and tools.
I start my presentation by discussing the importance of API contracts when decomposing behavior into microservices. Having strong API specifications via OpenAPI or other specification formats enables safe service mocking, at the expense of having to verify the correctness of our mocks. Along with a strong (verifiable) API contract, I emphasize isolating state within service boundaries, exposed only via that API.
Once we have well-defined services and localized state, we can change our approach to testing — I discuss specifically how various phases of testing
(design, unit, narrow and broad integration, acceptance, exploratory and within production) are impacted. I discuss service virtualization with Mountebank and mock validation with Pact and how those tools enable improved testing at these points in our test lifecycle.