TOPIC 22/6212 MINNOT STARTED

Contract testing ideas

Write down what an application programming interface (API) accepts and returns, and check both sides against it. A change that would break a caller then fails the same day.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: two friends agree a menu. They agree what will be cooked before the dinner. Warning before the evening depends on checking the proposed change and telling both friends, not merely writing a menu.

Daily List is a to-do list app. The phone app asks the Daily List server for tasks. Leo, the developer, owns the server. Another team owns the phone app. Tom, the tester, wants a change on one side not to surprise the other.

The phone app is the consumer, the program that uses an application programming interface (). The server is the provider, the program that offers an API. They write down a contract: an agreed description of what an API accepts and returns.

The phone app is tested against a controlled mock provider. The provider is separately verified against the recorded contract. One day Leo removes a required old field while adding its new name. When runs against that changed server, it reports the missing field. The phone app’s unchanged mock tests alone cannot discover a remote server change.

The picture has a limit. A menu is agreed once between two friends. An API contract may have many consumers, each needing a different part of it.

(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB Agreeing what an application programming interface () does, and checking both sides against it.

  1. Agree the contract
  2. Check both sides
  3. Warn before the change ships
Three beats

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
Two friendsConsumer and provider
The agreed menuContract
Warning before the eveningA failing contract check
Changing a dishChanging a field

WHERE THIS PICTURE STOPS

  • A menu is agreed once. An application programming interface (API) can have many consumers.
  • Friends talk. Programs only follow the contract.
  • A dish can be swapped at the table. A field cannot be renamed safely without a plan.

HOOK

Agree, check, warn.

REMEMBER IT THIS WAY

A story beat: one picture-line that carries the order or the cause.

Leo removes a required field on the server, then checks the changed server and warns the phone app team about the covered mismatch.

What each part of the trick stands for
In the trickWhat it stands for
Changed fieldChanging a field
WarningA failing provider verification warns about a covered mismatch

A contract check warns about what is written in the contract, so unwritten habits can still surprise.

TELL A FRIEND

Two friends agree a menu, and checking a proposed change can warn both before the evening.

OFTEN MIXED UP WITH Designing API tests. The application programming interface () design lesson tests one API. This lesson protects the agreement between two programs.

PRACTISE AND KEEP

Sources for this topic — 12 sources
  1. Market practice

    Introduction (Pact documentation) ↗ — Pact Foundation · Pact is a consumer-driven contract testing tool: the consumer sets out what it needs, running the tests makes a contract, and the provider checks that contract against its real API; only the parts the consumer uses are tested (search excerpt, page not opened)

    Per the search excerpt, Pact is a consumer-driven contract testing tool: the consumer writes tests that set out what it needs, running them makes a contract, and the provider checks that contract against its real application programming interface (API). Practitioner guidance, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  2. Market practice

    Writing consumer tests (Pact documentation) ↗ — Pact Foundation · Consumer tests run against a mock provider, record each request and reply as a contract, and share it with the provider (search excerpt, page not opened)

    Per the search excerpt, consumer tests run against a mock provider, record each request and reply as a contract, and share it with the provider. Practitioner guidance, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  3. Market practice

    OpenAPI Specification v3.1.0 ↗ — OpenAPI Initiative · An API description document lists addresses, fields and replies in a form both sides can read (registry entry staged in batch 13)

    Standard text. Describes paths, operations, parameters, schemas, required properties and responses; the Responses Object holds at least one response code. Search excerpt only. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

    8 November2026 bounded primary-source update: OpenAPI3.1.0 Introduction actually read 8 November2026: interface description for HTTP APIs. Not full OpenAPI audit or a generic live-message contract.

  4. Market practice

    Backwards compatibility (Google API design guidance, improvement proposal 180) ↗ — Google (API Improvement Proposals) · Removing a part of an existing API is a break, renaming is a removal plus an addition, and adding optional parts is the usual safe change (staged in batch 13)

    Per the search excerpt, removing a component from an existing API is a break, renaming is a removal plus an addition, and adding optional parts is the usual safe change. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

    8 November2026 bounded primary update: AIP180 Guidance/Adding/Removing/Renaming/Types/Semantic/default/valueformat selectedpassages read8November2026. Google API guidance, mainlyprotobuf/JSON and multiple independent consumers; source/wire/semantic compatibility and direction matter. Not everyAPI implementation or comprehensive list.

  5. Market practice

    Integration test (Martin Fowler) ↗ — Martin Fowler · An integration test can be narrow, covering the code that talks to another part, with a fake on the far side (search excerpt, page not opened)

    Per the search excerpt, the term is used loosely, and an integration test can be narrow, covering the code that talks to another part, or broad, covering most of the system. A broad-stack test is often called end-to-end. Practitioner guidance, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  6. Market practice

    Pending pacts ↗ — Pact project · Pending verification may leave the provider build green while recording a failed verification. It does not make the unsupported consumer safe to deploy. Pending status depends on pact content, verification history and provider branch. (primary page opened and read, 2026-10-21)

    Pending verification may leave the provider build green while recording a failed verification. It does not make the unsupported consumer safe to deploy. Pending status depends on pact content, verification history and provider branch. · Checked 2026-10-21

    Primary page opened and read on 2026-10-21. Scope is the claim described here; this does not upgrade earlier citations to other pages. Examples in Daily List are synthetic teaching examples.

  7. Market practice

    Can I Deploy ↗ — Pact project · The Pact Matrix records exact consumer/provider version pairs and verification results. Deployment checks use the target environment and its recorded deployed or released versions. (primary page opened and read, 2026-10-21)

    The Pact Matrix records exact consumer/provider version pairs and verification results. Deployment checks use the target environment and its recorded deployed or released versions. · Checked 2026-10-21

    Primary page opened and read on 2026-10-21. Scope is the claim described here; this does not upgrade earlier citations to other pages. Examples in Daily List are synthetic teaching examples.

  8. Market practice

    ISTQB Certified Tester Advanced Level Test Automation Engineering (CTAL-TAE) Syllabus v2.0 ↗ — International Software Testing Qualifications Board (ISTQB) · Section 5.1.3 (printed page 36): API dependencies (connections and documentation); contract testing as integration testing beyond schema validation; consumer-driven and provider-driven approaches; version 2.0 of 2024-05-03, mirror copy of the publisher PDF, version checked against front matter, opened

    Version 2.0 syllabus (3 May 2024), read in full text. Used for the objective ids and levels in chapters 1 to 8, the deployment risks, the verification of the automation solution and the configuration management of testware. Paraphrased, not quoted. · Checked 2026-11-07

    Primary publisher body opened and relevant sections read on 6 November 2026; selected-section reading, not a claim every page or external link was read. See docs/research/v16-testing-automation-literacy-audit-20261106.md for exact sections, version and limitations.

    V52 additionally read actual publisher PDF7 November 2026: version 2.0,3 May 2024 front/introduction and all substantivechapters 1–8/29 learning objectives, throughprintedp 53 and selectedreferences. Not every appendix or cited book. §3.1.5 says interface substitution; Martin’s original calls it Interface Segregation. Preserve the source discrepancy separately. No unrestricted commercial image permission established.

  9. Market practice

    How Pact works — consumer tests and provider verification ↗ — Pact Foundation · How Pact works: real consumer code against mock provider, generated contract, independent provider states and verification against actual provider; static replay cannot discover fresh provider changes (relevant primary passages opened6November2026).

    Actual consumer client against mock provider, pact generation, independent provider states and provider verification opened. Product guidance, not a universal testing standard. Original figure source bytes matched repositorye2072af34960cb19d6c132d370c2fd580ec0e55c under the documentation MIT notice. · Checked 2026-11-08

    Opened relevant primary passages on6November2026 via normal web search and document view. Actual consumer client against mock provider, pact generation, independent provider states and provider verification opened. Product guidance, not a universal testing standard. Original figure source bytes matched repositorye2072af34960cb19d6c132d370c2fd580ec0e55c under the documentation MIT notice.

    8 November 2026: actual HTTP interaction, Consumer Testing and Provider Verification sections through Putting It All Together opened, page footer 23 December 2024. Consumer checks and selected provider response verification are distinct; a written contract alone is not verification. No whole transport or deployed-behavior guarantee.

  10. Market practice

    Introduction (Pact documentation) ↗ — Pact Foundation · Introduction, What is contract testing / Consumer Driven Contracts / Provider contract testing; complete substantive page opened 7 November 2026, updated 25 August 2026: concrete consumer interactions and provider verification, not every client/version or whole-system behavior.

    Per the search excerpt, Pact is a consumer-driven contract testing tool: the consumer writes tests that set out what it needs, running them makes a contract, and the provider checks that contract against its real application programming interface (API). Practitioner guidance, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  11. Market practice

    Writing consumer tests (Pact documentation) ↗ — Pact Foundation · Writing Consumer tests, scope/matching/actual API client/provider states and security; complete substantive page opened 7 November 2026, updated 16 May 2025: exercise actual client with controlled mock; selected interactions are not exhaustive provider business tests.

    Per the search excerpt, consumer tests run against a mock provider, record each request and reply as a contract, and share it with the provider. Practitioner guidance, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  12. Market practice

    Backwards compatibility (Google API design guidance, improvement proposal 180) ↗ — Google (API Improvement Proposals) · AIP 180, complete guidance/rationale/changelog opened 7 November 2026: source/wire/semantic compatibility, additions/defaults and removing or renaming components; Google guidance scoped to applicable API and client policy, header 2019 with changelog through 21 October 2025.

    Per the search excerpt, removing a component from an existing API is a break, renaming is a removal plus an addition, and adding optional parts is the usual safe change. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

    8 November2026 bounded primary update: AIP180 Guidance/Adding/Removing/Renaming/Types/Semantic/default/valueformat selectedpassages read8November2026. Google API guidance, mainlyprotobuf/JSON and multiple independent consumers; source/wire/semantic compatibility and direction matter. Not everyAPI implementation or comprehensive list.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.