Skip to main content

Defining contracts

ContractCase is consumer driven, meaning that we define the contract on the side of the communication boundary that consumes information. Later, that contract is verified on the side of the communication boundary where information is provided.

Consumer driven contract testing has three main steps:

  1. Contract definition (this section), where you describe the expectations that the consumer has about the provider
  2. Contract verification, where you verify that the provider meets the expectations of its consumers
  3. Deploy checks, where at deploy time, you ensure that the thing you're about to deploy is compatible with the environment you're deploying in. That is:
    • Any expectations it has about providers have been verified by the version(s) of providers that are currently deployed`
    • Any expectations from any consumers that are already deployed have been verified

This section describes how to write contracts, and details the lifecycle of an interaction during contract definition.

If you already have a contract, and you want to know how to verify it, you can skip to contract verification.