【发布时间】:2016-11-29 21:28:30
【问题描述】:
给定一个测试向第 3 方 API 发送消息的场景,我可以为消息的每个属性将多个给定和结果添加到单个场景中。这使得场景相当复杂。
我也可以将它们分解为不同的场景。但它们确实没有不同的场景。
这是一个有多个给定和结果的场景:
Scenario 1: An order
Given an order
And that has order ID equal to 42
And that has affiliate reference equal to foo
When the conversion for the order is sent
Then the conversion has an ID equal to 42
And the conversion has an affiliate ID equal to foo
在这里,我将其分解为多个场景:
Scenario 1: An order with a specific order ID
Given an order that has order ID equal to 42
When the conversion for the order is sent
Then the conversion has an ID equal to 42
Scenario 2: An order with a specific affiliate reference
Given an order that has affiliate reference equal to foo
When the conversion for the order is sent
Then the conversion has an affiliate ID equal to foo
【问题讨论】:
-
我认为您不应该将场景视为测试——它不会测试任何东西。你也不应该去想它,因为它是一个过程——没有任何输入和输出。场景是一段文档。它描述了您的系统在某些给定条件下应如何工作。描述这些条件——环境——在Givens中,一个事件——在Whens中,以及你的系统应该如何对正在发生的事情做出反应——在Thens中。
-
@Shamaoke 虽然我大体上同意你的说法(尤其是第一部分),但我认为可以有输入和输出,这取决于你描述的行为。