Practise core consumer-driven contract testing vocabulary: consumer, provider, pact, interaction, provider state, and the CDC philosophy.
0 / 5 completed
1 / 5
In consumer-driven contract testing, the ___ is the service that initiates API calls and defines what it expects from the API.
The consumer is the service that calls the API. In CDC, the consumer defines the contract — the minimum interactions it needs — and the provider must satisfy these expectations.
2 / 5
A ___ is the document that records the consumer's expected interactions with the provider: request formats, response structures, and status codes.
A pact (contract) is a JSON document recording all interactions the consumer expects. It includes: request method/path/headers/body and expected response status/body. The provider must verify it can fulfil each interaction.
3 / 5
In Pact, a ___ sets up a specific scenario in the provider's system before an interaction is verified — for example, 'given a user with ID 123 exists'.
A Provider State is a named precondition that the provider sets up before verifying a specific interaction. It ensures the provider database/state matches what the consumer assumed when writing its test.
4 / 5
The CDC philosophy states that the ___ defines what it needs from the API, rather than the provider dictating what it offers.
CDC inverts the traditional API ownership model: the consumer declares the minimum contract it needs, and the provider verifies it can satisfy that contract. This prevents the provider from making unilateral breaking changes.
5 / 5
Unlike integration tests, consumer-driven contract tests allow consumer and provider to be tested ___.
CDC tests allow each service to be tested independently: the consumer tests against a mock (the pact), and the provider verifies the pact without needing the consumer running. This eliminates fragile shared integration environments.