SpringCloud 调用生成的测试
2023-12-08 17:45 更新
Spring Cloud Contract Maven插件在名为/generated-test-sources/contractVerifier
的目录中生成验证代码,并将该目录附加到testCompile
目标。
对于Groovy Spock代码,请使用以下代码:
<plugin> <groupId>org.codehaus.gmavenplus</groupId> <artifactId>gmavenplus-plugin</artifactId> <version>1.5</version> <executions> <execution> <goals> <goal>testCompile</goal> </goals> </execution> </executions> <configuration> <testSources> <testSource> <directory>${project.basedir}/src/test/groovy</directory> <includes> <include>**/*.groovy</include> </includes> </testSource> <testSource> <directory>${project.build.directory}/generated-test-sources/contractVerifier</directory> <includes> <include>**/*.groovy</include> </includes> </testSource> </testSources> </configuration> </plugin>
为确保提供方符合已定义的合同,您需要调用mvn generateTest test
。
以上内容是否对您有帮助:
更多建议: