Terminology

    Service Provider

    A server that responds to an HTTP request from another component (the service consumer). A service provider may have one or more HTTP endpoints, and should be thought of as the “deployable unit” - endpoints that get deployed together should be considered part of the same provider.

    Used by tests in the consumer project to mock out the actual service provider, meaning that integration-like tests can be run without requiring the actual service provider to be available.

    Interaction

    A file containing the JSON serialised interactions (requests and responses) that were defined in the consumer tests. This is the Contract. A Pact defines:

    • the consumer name
    • the provider name
    • a collection of interactions

    Pact verification

    To verify a Pact contract, the requests contained in a Pact file are replayed against the provider code, and the responses returned are checked to ensure they match those expected in the Pact file.

    A provider state name is specified when writing the consumer specs, then, when the pact verification is set up in the provider the same name will be used to identify the set up code block that should be run before the request is executed.

    Pact Specification

    The is a document that governs the structure of the actual generated Pact files to allow for interoperability between languages (consider, for example, a JavaScript consumer connecting to a Scala JVM-based provider) , using semantic versioning to indicate breaking changes.

    The current version of the specification is 3.0 for the JVM implementation, and for all others.