[英]How to integrate pact-jvm provider only with json file
I want to test my spring-boot Rest API by using a pact json file provided.我想通过使用提供的协议 Z466DEEC76ECDF5FCA6D38571F6 文件来测试我的 spring-boot Rest API。 The thing is all the resources on internet points to verifying using pact-broker.事情是互联网上的所有资源都指向使用契约经纪人进行验证。 I will get there but currently, working on a POC for this is turning out to be quite difficult.我会到达那里,但目前,为此开发 POC 非常困难。
No matter what pom configuration, it tries to connect to localhost.无论 pom 配置如何,它都会尝试连接到 localhost。
Here's my pom.xml这是我的 pom.xml
<plugin>
<groupId>au.com.dius.pact.provider</groupId>
<artifactId>maven</artifactId>
<version>4.1.11</version>
<configuration>
<serviceProviders>
<serviceProvider>
<name>Service</name>
<consumers>
<consumer>
<name>consumer123</name>
<pactSource>/Usr/Pact-JVM-Example/pacts/</pactSource>
</consumer>
</consumers>
</serviceProvider>
</serviceProviders>
<pactBrokerUrl/>
</configuration>
</plugin>
Please note that the json is physically residing on the provided path /Usr/Pact-JVM-Example/pacts/
.请注意,json 物理上位于提供的路径/Usr/Pact-JVM-Example/pacts/
上。 Also, I've intentionally removed pactBrokerUrl
as I am not planning to connect to a remote pact json.另外,我故意删除pactBrokerUrl
,因为我不打算连接到远程 pact json。
In the end, I want the test to pass/fail on the basis of the json file in /Usr/Pact-JVM-Example/pacts/
when I run ./mvnw pact:verify
最后,当我运行./mvnw pact:verify
时,我希望测试基于/Usr/Pact-JVM-Example/pacts/
pacts/ 中的 json 文件通过/失败
Please check the main readme here https://github.com/pact-foundation/pact-jvm/tree/master/provider/maven请在此处查看主要自述文件 https://github.com/pact-foundation/pact-jvm/tree/master/provider/maven
This plugin is for verifying a running provider此插件用于验证正在运行的提供程序
It always tries to call a localhost server by default.默认情况下,它总是尝试调用本地主机服务器。 You need Junit4 or Junit5 libraries你需要Junit4或Junit5库
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.