Search code examples
testingpactcontract

How to trigger producer contract test automatically if consumer contract changes


If the consumer makes a change which can break the contract test can only be identified if producer is also build but if we don't build the producer the wrong consumer will be released to production.

Is there an approach which can be followed to overcome these type of scenarios.


Solution

  • Yes, there is definitely an approach! We go into length about this on our article how to build an effective Pact pipeline.

    Some of the key tips described in the article:

    • It is recommended to setup a Pact Broker (https://github.com/pact-foundation/pact_broker/) or use a hosted service like pactflow.io to facilitate the contract exchange and CI/CD workflow
    • You should use can-i-deploy to prevent consumers/providers releasing a change that will break the integration
    • You can use tags and pending pacts (relatively new feature) to manage the introduction of new contracts into the system safely.