【发布时间】:2014-02-12 10:55:28
【问题描述】:
通过 SpecFlow 文档,我试图弄清楚我的看法是否错误。我想为每个功能指定几个完全不同的场景。
例如:
Feature: Serve coffee
Coffee should not be served until paid for
Coffee should not be served until the button has been pressed
If there is no coffee left then money should be refunded
Scenario: Buy last coffee
Given there are 1 coffees left in the machine
And I have deposited 1$
When I press the coffee button
Then I should be served a coffee
如果我想查看“提供咖啡”功能中的其他场景怎么办?例如,支付了钱但 5 分钟未按下按钮的场景。
有几个场景有意义还是我应该使用场景大纲?
谢谢!
【问题讨论】:
-
我认为您有这些疑问的原因是由于您对功能的定义非常广泛。尝试使用
As a ... I want ... So that ...模式来描述您的功能,您会发现它有助于保持您的场景分离