0
我正在尝试Spring Cloud联系人:我在我的spring-boot应用程序中有一个端点“/ greeting”,并且它返回“Hello World!”。Spring Cloud Contract不适用于Surefire 2.20
该合同是象下面这样:
request {
method 'GET'
url '/greeting'
headers {
contentType('application/json')
}
}
response {
status 200
body([
"content": "Hello, World!"
])
}
我的测试类:
public class ExampleJavaConsumerPactTestIT {
@Before
public void setup() {
RestAssuredMockMvc.standaloneSetup(new GreetingController());
}
@Test
public void aQuickTest(){
}
}
一切正常:如果我改变上述合同 “内容”:“你好!“,然后测试失败。
然而,当我在我的依赖添加到用户神火插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
</plugin>
然后,我错了合约再次运行测试(内容“:‘你好!’),这个测试应该失败,但它没有。
这有什么错?
你可以在任何地方发布你的样本吗?如果没有这个,将很难帮助你... –
是ExampleJavaConsumerPactTestIT你的验证器基类吗? 否则 **/* IT.java 可能不包括它。 –
Jeff
@MarcinGrzejszczak我把我的来源在这里https://github.com/pkid/spring-cloud-contract-with-surefire。基本上我期望构建失败,如果我做“mvn clean test -Pcontract-tests” – Yashu