Quick Answer
Contract testing verifies that a service honors the contract (request/response format) expected by its consumers. Producer tests: does the service produce the agreed-upon response? Consumer tests: does the consumer correctly parse what the producer sends? Tools like Pact automate this. Prevents breaking API changes from reaching production without catching them early.
Answer
Ensures service providers and consumers agree on an API contract. Tools: Pact, Spring Cloud Contract. Prevents runtime failures caused by incompatible API changes.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.