【发布时间】:2019-10-23 01:38:39
【问题描述】:
刚开始使用小黄瓜,我需要为我的 Rest API 编写小黄瓜场景。
有这样一种场景,用户输入客户 ID 和订单 ID,其余服务根据一些检查将订单 ID 与客户 ID 联系起来。然后返回完整的订单详情。
我引用的小黄瓜场景如下:
Scenario: Associate an order to customer
When User provides order to attach to customer
Then User should get the associated order details
现在,如果客户或订单 ID 无效,则其余调用将响应相应的错误消息。
我应该使用 GIVEN 来确保客户和订单 ID 存在吗?
GIVEN:ID 为“abc”的客户出口 以及 ID 为“bcd”的订单退出
GIVEN 这里有什么意义吗? 编写此示例场景的最佳方法是什么?
【问题讨论】:
标签: testing integration-testing gherkin