【发布时间】:2011-02-22 06:22:23
【问题描述】:
我正在使用 SpecFlow,我想写一个如下所示的场景:
Scenario: Pressing add with an empty stack throws an exception
Given I have entered nothing into the calculator
When I press add
Then it should throw an exception
是calculator.Add()会抛出异常,那么在标记为[Then]的方法中该如何处理呢?
【问题讨论】:
-
嘿,您觉得这些答案有用吗?
-
@scoarescoare:是的。问题是包含所有必需信息的正确答案是您和 Kjetil 的组合。你的回答说我的语言是错误的,而 Kjetil 实际上说如何从
When到Then获取异常(或其他输出)。 -
感谢您提出这个问题。我发现自己也在想同样的事情!
标签: specflow expected-exception