spring-webfluxspring-boot-testpactpact-jvm

How to do a pact contract verification test from a json contract


I know to do pact verification using

   @pactBroker(host="hostname", authentication="someAuthtextInbase64")

where all the contract details are present and I can connect and verify.

Now I want to run a pact test without involving the pact broker as my consumer is not ready, my consumer provided a valid contract json and I am suppose to verify it from provider end with just the contract json? Could any one help on this please?


Solution

  • See https://docs.pact.io/implementation_guides/jvm/provider/junit#pact-source. You probably want the @PactFolder or @PactUrl annotation.

    Now I want to run a pact test without involving the pact broker as my consumer is not ready, my consumer provided a valid contract json and I am suppose to verify it from provider end with just the contract json?

    Even if the consumer is not ready, they should still publish to the Pact Broker. This is what branches/tags etc. are for. You might like to see https://docs.pact.io/pact_nirvana or https://docs.pactflow.io/docs/workshops/ci-cd/ for more on the recommended workflow.