PRO Workshop (API): Contract Driven Development - Deploying Your Microservices Independently without Integration Testing

API World -- VIP Workshop Room

Hari Krishnan
Polarizer Technologies, Polyglot Full Stack Developer

Polyglot Full Stack Developer, Architecture Consultant, XP Coach and Trainer, with over 17 years of experience. I have worked across multiple tech stacks and application architectures. My domain exposure includes investment banking, network security, telecommunications, logistics and retail. Apart from writing code I coach other developers, project managers and product owners. I advise organisations both large and small on transformation activities. I have spoken at Agile 2021, TestingUY 2021, SREConf, PyCon Singapore, RubyConf India, Agile India, Devops Days and Garden City RubyConf.

Our largest hurdle in deploying a MicroService was the Integration Testing stage. Just one incompatible API was enough to break the integration environment and block the path to production for all services.

While adopting OpenAPI helped address some of the communication gaps in API specs between teams, the deviations during implementation continued to persist. We needed an approach that changed the way teams collaborated on API Specs and also remove the need for integration testing.

To fill this need we came up with Contract Driven Development which consists of
1. Contract as Test - Contract (Example: OpenAPI) translated to Test Scenarios against the API implementation. Ensures that Provider (API implementation) adheres to Contract.
2. Smart Service Virtualisation - Verify Stub Data against OpenAPI Spec. Ensures the Consumer (API Client) is compatible with Provider's Contract.
3. Backward Compatibility Testing - OpenAPI vs OpenAPI (no code) to check if versions are backward compatible. Helps teams analyse if a change will break integration.