Library › Book 4 › The Contract Testing Problem
The Contract Testing Problem
8.1🔒Why Integration Tests Are Not EnoughIn a microservices architecture, Service A calls Service B. Both services have their own test suites. Service B's tests verify that its…
8.2🔒Consumer-Driven Contracts: Flipping the RelationshipConsumer-driven contracts solve this by having the consumer (Service A) publish a formal description of what it expects from the provider…
8.3🔒When to Use Contract TestingContract testing is most valuable when:
8.4🔒Anatomy of a Pact ContractA Pact contract is a JSON file that describes one or more interactions between a consumer and a provider:
8.5🔒Q&ASelf-Assessment Quiz1. What is the "contract gap" in microservices testing? 2. How does consumer-driven contract testing flip the traditional API relationship?…
8.6🔒Key Takeaways- The contract gap exists between what consumers expect and what providers deliver -- traditional unit and integration tests do not cover…
8.7🔒ExercisesExercise 8.1 (Starter): Draw an architecture diagram of a system you work with or are familiar with. Identify which service pairs would…
8.8🔒Career Translation- Identified and eliminated the contract gap in a 12-service microservice architecture by introducing consumer-driven contract testing…
8.9🔒Q&AInterview Depth CheckPrompt: Service A depends on Service B. Both have passing test suites. After deploying Service B with a field rename, Service A breaks in…