Contract testing: captures the consumer's expectations of a provider into a contract file, then verifies the provider actually fulfils those expectations independently, enabling decoupled deployment.
2 / 5
What is the role of a Pact broker?
Pact broker: consumers publish their pact files to the broker; provider CI fetches and verifies them. The broker records results, enabling can-i-deploy checks that prevent breaking changes from reaching production.
3 / 5
What is a consumer-driven contract?
Consumer-driven: instead of the provider guessing what clients need, each consumer codifies exactly what it uses. Providers only need to satisfy real consumer needs, making API evolution safer.
4 / 5
How does contract testing differ from end-to-end testing?
vs E2E: E2E tests are slow, brittle, and need full environments. Contract tests run fast in isolation — the consumer mocks the provider, and the provider test runs against a replay. No shared environment needed.
5 / 5
What is a provider state in Pact?
Provider state: e.g. "an order with id 42 exists". Before verifying that interaction, the provider sets up the required data via a state handler, ensuring the test is repeatable and independent.