[英]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.