How does Pact work?
- In the tests for the provider facing code in the consumer project, expectations are set up on a mock service provider.
- When the tests are run, the mock service returns the expected responses. The requests, and their expected responses, are then written to a “pact” file.
- The requests in the pact file are later replayed against the provider, and the actual responses are checked to make sure they match the expected responses.