pact-合同测试 - PACT文件没有被执行

时间:2017-08-28 06:04:47

标签: pact

最初通过从github位置下载项目来开始分析PACT。在现有项目中,我已经包含了我的GET请求服务代码.groupkt.com/country/get/iso2code/IN。

我能够生成PACT文件,但是当我尝试从生产者端验证时,我得到以下消息

 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

有人可以帮我解决这个问题。

提前致谢

Sushma

1 个答案:

答案 0 :(得分:1)

这可能是在创建PACT的消费者测试中提到的提供者名称的问题。我认为您的代码在您的消费者契约类中具有以下值。

@Pact(provider =“Foo_provider”,consumer =“Foo_consumer”)

请根据您的要求更改提供商和消费者名称。再次运行使用者测试,然后运行提供程序测试。