简体   繁体   English

如何通过spring-cloud-contract获得对先前请求的响应

[英]How to get a response of the previous request with spring-cloud-contract

Let's say I have a scenario that consists of 3 steps: 假设我有一个包含3个步骤的方案:

  • Create an item. 创建一个项目。
  • Update it by ID. 通过ID更新。
  • Delete it by ID. 按ID删除它。

The first step is quite straightforward, I just submit a request and verify response as it's described here 第一步是很简单,我只是提出请求,因为它描述的验证响应这里

The problem starts with step 2. In order to perform Update and Delete I need to know the ID of the item saved in the step 1. Is there any way with spring-cloud-contracts to extract it from step 1 response? 问题开始于步骤2。为了执行更新和删除,我需要知道步骤1中保存的项目的ID。spring-cloud-contracts是否可以从步骤1响应中提取出来?

Not really. 并不是的。 However it seems that you're misusing the tool. 但是,您似乎在滥用该工具。 You're trying to use Spring Cloud Contract for acceptance testing. 您正在尝试使用Spring Cloud Contract进行验收测试。 Why not just set fixed values and verify the semantics? 为什么不只是设置固定值并验证语义呢?

暂无
暂无

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

相关问题 如何在 spring-cloud-gateway 合约测试中从 spring-cloud-contract 中设置带有 StubRunner 端口的 url - How to set urls with port of StubRunner from spring-cloud-contract in spring-cloud-gateway contract tests 用于 spring-cloud-contract 的自定义存根生成器 - Custom stub generator for spring-cloud-contract Spring Cloud Contract:从场景中的先前响应获取参数 - Spring cloud contract: get params from previous response in scenario Spring-cloud-contract 测试对 JAXRSCLIENT 不起作用 - Spring-cloud-contract testing doesn't work for JAXRSCLIENT 我们可以将spring cloud contract请求/响应属性设为可选吗? - can we make spring cloud contract request/response attribute optional? spring 云合同可以处理具有不同响应的重复请求吗? - can spring cloud contract handle repeated request with different response? mvn clean install对于我的春季云合同消费者测试是成功的,但是当我手动运行测试时,它们失败了吗? - mvn clean install is SUCCESS for my spring-cloud-contract consumer tests, but when I run the tests manually they are FAILING? 如何在Spring Cloud Contract存根上获取服务状态 - How to get service state on spring cloud contract stub 无法在Spring Cloud Contract中发送过帐请求 - Unable to send the post request in spring cloud contract 如何在 Spring Cloud Contract Groovy DSL Contract 定义中将请求正文对象属性定义为可为空? - How define request body object property as nullable in Spring Cloud Contract Groovy DSL Contract definition?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM