pact- Contract Testing- The PACT file is not getting picked up for the execution

2k views Asked by At

Initially started to analyze PACT by downloading the project from github location. In the existing project i have included my code for a GET request services.groupkt.com/country/get/iso2code/IN.

I was able to generate the PACT file but when i try to verify from the producer end i get the below message

 D:\microservices-pact-maven-master\microservices-pact-consumer>mvn    au.com.dius:p
act-jvm-provider-maven_2.11:verify
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building microservices-pact-consumer 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- pact-jvm-provider-maven_2.11:3.2.2:verify (default-cli) @ microservic
es-pact-consumer ---
Loading pact files for provider Foo_Provider from D:\microservices-pact-maven-ma
ster\microservices-pact-consumer\target\pacts
Skipping D:\microservices-pact-maven-master\microservices-pact-consumer\target\p
**acts\Country_Consumer-Country_Provider.json as the provider names don't match pr
ovider.name: Foo_Provider vs pactJson.provider.name: Country_Provider
Found 1 pact files**

Verifying a pact between Foo_Consumer and Foo_Provider
  [Using file D:\microservices-pact-maven-master\microservices-pact-consumer\tar
get\pacts\Foo_Consumer-Foo_Provider.json]
  a request for Foos
    returns a response which
      has status code 200 (OK)
      includes headers

Could someone help me fix this issue.

Thanks in advance

Sushma

1

There are 1 answers

11
sivaganesh sivakumar On

This could be an issue with the provider name mentioned in the consumer test where the PACT is getting created. I think your code is having the below values in your consumer pact class.

@Pact(provider = "Foo_provider", consumer = "Foo_consumer")

Please change the provider and consumer names as per your requirement. Run the consumer test again and then run the provider test.