【发布时间】:2018-10-14 19:37:02
【问题描述】:
他们say认为BDD的基本规则是:
一种情景,一种行为!
这很好,但事实是我有一个动作会触发系统中的许多不同的事情。我必须验证所有这些事情都会发生。这是我的小黄瓜:
Scenario: Buying a single product to be delivered now
Given I am in the checkout page
When I checkout the order
Then the order should be created to the specified address
And the order should be set in pending state
And ops must be notified via a slack notification
And A shopper must be auto assigned the order via a push notification
And A retailer must be notified about the order via a push notification
And A transaction must be recorded in the payment gateway
And My wallet should be deducted by the payment amount
这看起来真的很难看。但现在我不知道如何分开它。做一个 Background 似乎并没有削减它,因为在背景中,您只是为多个场景设置了基础,每个场景都有它的 when 和 然后 对(在我的情况下,我使用 Behat,which has 一个 given,when 和 then 在每个场景之后背景)。
建议?
【问题讨论】: