简体   繁体   English

如何仅将 pact-jvm 提供程序与 json 文件集成

[英]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你需要Junit4Junit5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 契约提供者测试的范围应该是什么? - What should be the scope of a Pact provider test? 无法运行 JUnit5 PACT 测试。 在提供程序 '' 的测试 class ConsumerContractTest 中找不到使用 @Pact 注释的方法 - Unable to run JUnit5 PACT test. No method annotated with @Pact was found on test class ConsumerContractTest for provider '' 除了提供者与 Pact 的交互声明之外,我们还需要断言吗? - Do we need assertions in addition to the provider interaction declaration with Pact? 我的 PACT 测试有什么问题以及如何解决? - What is wrong with my PACT Test and how to fix it? 由于NoHttpResponseException导致Pact文件创建失败:127.0。*。*。***无法响应 - Pact File creation failed due to NoHttpResponseException : 127.0.*.*.*** failed to respond 如何为多部分/表单数据上传cdc测试创建PACT - how to create PACT for multipart/form-data uploading cdc test 你如何正确地将文件解析的单元测试与pytest集成? - How do you properly integrate unit tests for file parsing with pytest? 如何在一个cmake文件中集成g ++和gtest - How to integrate g++ and gtest in one cmake file 如何模拟会员提供者 - How to mock membership provider 未检测到 Pact 测试 PactProviderRule - Pact Testing PactProviderRule not detected
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM