简体   繁体   English

如何通过Spring Cloud Contract Verifier跳过测试生成Maven目标?

[英]How to skip the test generation maven goal with Spring Cloud Contract Verifier?

I want to test a service Consumer that uses FeignClient to call another service, Producer, that I have. 我想测试一个使用FeignClient调用我拥有的另一服务(生产者)的服务使用者。 In order to stub the service called, I'm using spring-cloud-contract-verifier for the producer and spring-cloud-contract-stub-runner on the consumer. 为了对调用的服务进行存根,我对生产者使用spring-cloud-contract-verifier,对消费者使用spring-cloud-contract-stub-runner。

My problem is that I already have written integration tests for the producer, so I'd just like to generate the stubs and skip the tests generation. 我的问题是我已经为生产者编写了集成测试,所以我只想生成存根并跳过测试的生成。 Using the spring-cloud-contract-maven-plugin, I've tried to set up only the goals I need, but it's still trying to run the tests anyway. 使用spring-cloud-contract-maven-plugin,我尝试仅设置所需的目标,但无论如何仍在尝试运行测试。 I suspect I'm not setting it up correctly... 我怀疑我没有正确设置...

<plugin>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-contract-maven-plugin</artifactId>
    <version>${spring-cloud-contract.version}</version>
    <extensions>true</extensions>
    <executions>
        <execution>
            <goals>
                <goal>convert</goal>
                <goal>generateStubs</goal>
            </goals>
            <configuration>
                <basePackageForTests>com.example</basePackageForTests>
            </configuration>
        </execution>
    </executions>
</plugin>

when I run mvn clean install, it's still expecting a TestBase. 当我运行mvn clean install时,仍然期望使用TestBase。 How can I skip this goal? 如何跳过这个目标?

If you check the documentation ( https://cloud.spring.io/spring-cloud-static/spring-cloud-contract/1.2.4.RELEASE/spring-cloud-contract-maven-plugin/generateTests-mojo.html ) you'll see that you can do a number of things. 如果您查看文档( https://cloud.spring.io/spring-cloud-static/spring-cloud-contract/1.2.4.RELEASE/spring-cloud-contract-maven-plugin/generateTests-mojo.html )您会看到您可以做很多事情。 -DskipTests , -Dspring.cloud.contract.verifier.skip=true . -DskipTests-Dspring.cloud.contract.verifier.skip=true Always read the documentation. 请务必阅读文档。

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

相关问题 spring cloud 合同验证器测试失败,spring cloud bus - spring cloud contract verifier test fails with spring cloud bus Maven 构建失败,Spring-cloud-contract-verifier - Maven build fails with Spring-cloud-contract-verifier 如何在不构建项目中的所有单元和合同测试的情况下生成和运行单个合同测试? Java Spring Cloud 合约验证器 - How to generate and run a single contract test without building all the unit and contract tests in the project? Java Spring Cloud Contract Verifier Spring Cloud Contract Verifier 测试生成不需要的断言 - Spring Cloud Contract Verifier Test Generating Unwanted Asserts 骆驼 kafka 主题中的 spring-cloud-contract-verifier 清理消息 - spring-cloud-contract-verifier cleanup messages in camel kafka topics 如何动态跳过 maven antrun copy/shade:shade 目标? - How to skip the maven antrun copy/shade:shade goal dynamically? Spring Cloud Contract 测试适用于 Maven,但不适用于 JUnit - Spring Cloud Contract tests work with Maven but not when run with JUnit 使用maven时Spring Cloud Contract编译问题 - Spring Cloud Contract compilation problems when using maven 在非Spring项目中运行Spring Cloud Contract测试 - Running Spring Cloud Contract test in non-Spring project 如何让 Spring Cloud Contract 在每次测试之前或之后重置 WireMock - How to make Spring Cloud Contract reset WireMock before or after each test
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM