liveBook · Manning

Contract

As explained in Vibe Engineering

An API is a defined interface through which software systems communicate and invoke one another's capabilities.

An API contract records what a service consumer expects and what a provider promises to deliver. Contract tests check that both sides still agree. section 8.5.2

Use the contract to make service expectations explicit:

  • Have the consumer declare a request and its expected response. section 8.5.2
  • Verify that the provider returns the expected response; fail tests when either side changes incompatibly. section 8.5.2
  • Treat passing tests as evidence that specified requirements hold, not proof of deeper correctness. section 8.3.7

Parser in a rendering service

A content management system sends markup such as `# Hello` and expects HTML such as `<h1>Hello</h1>`. Contract tests catch parser changes that break that expectation. section 8.5.2

How Vibe Engineering covers it

How deep it goes
Defines consumer-provider checks with a worked request-response example and distinguishes specified behavior from deeper correctness.
Examples
Uses a CMS sending markup to a rendering service and expecting HTML in return.
What you can do after
Diagnose service-breaking API changes by running tests against consumer expectations and provider responses.
How it connects
Connects contract testing with design by contract, service consumers and providers, and test-driven development.

Also explained in

Compare how 58 books explain contract →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Vibe Engineering. The section links point to the parts of the book it draws on.