2. Hi 👋🏼
I’m Gaurav Singh 🏼🏼
Test automation 🏼 at Gojek, Bangalore
Full stack tester …. (mobile 📱, web 🏼, backend 🏼)
Find me on below:
3. Learning goals
• What is consumer driven contract testing?
• What problems does it solve over integration tests?
• Understand it’s nuts and bolts ⚙️
• Implement a contract test for a twitter like API using PACT
framework with JVM
• When not to use? 🏼
6. Consumer driven contracts 🏼
• Confirms contract between a consumer and provider (called
• Written from the consumer’s perspective 📲 🏼 🌍
• Allows testing them in isolation
• Supports testing HTTP, message queues
20. If all you have a hammer…
• Check minimal shared understanding of what the provider should
return to us.
• Works best if you/your org/partner org are developing the consumer
• Write to substitute all functional integration tests (don’t check side-
• Use it for performance and load testing
• To Test Pass through APIs
1. Using the Pact DSL, the expected request and response are registered with the mock service.
2. The consumer test code fires a real request to a mock provider (created by the Pact framework).
3. The mock provider compares the actual request with the expected request, and emits the expected response if the comparison is successful.
4. The consumer test code confirms that the response was correctly understood