Consumer-Driven Contracts: A Service Evolution Pattern presents the idea of contracts verification.

But how detailed is the contract?

  • Is the contract defining only a syntax of requests/responses? Like WSDL in the case of SOAP Web services.

  • Or does it describes also the order of messages, i.e., the protocol? e.g.:


  • Or does it define also the behaviour of a system? In other words if I send request R and system is in state S I should receive response W? For instance, if I send a request to buy two monitors and the shop has only one monitor I should get negative but when I request only one monitor I should receive a receipt?

1 Answer 1


Avoid full behaviour simulation.

What's a contract?

A contract is a set of shared expectations between a service that acts as a consumer and another service that acts like a producer. They focus the specification and delivery of service functionality around key business value drivers. The compatibility of a contract should remain stable and immutable for a particular set of consumer contracts and expectations.


As a consumer, we need to exactly define our expectations. For example, when sending a request from the consumer to the producer, we want to make sure that we receive a successful response that matches our request.


The purpose of contract testing is not to start writing business features in the contracts. Stay focused and limit yourself to testing contracts between applications and avoid full behaviour simulation.

You can read more about contracts here: http://ordepdev.me/posts/boost-your-confidence-with-consumer-driven-contracts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.