是否有任何带有BDD规范的MVC示例应用程序可用作参考?

时间:2013-02-25 09:07:26

标签: unit-testing bdd

我正在学习BDD:如何编写有效的测试,测试的内容以及要离开的内容。我也在努力解决BDD中“行为”的确切定义。

是否有任何带有BDD规范的MVC示例应用程序可用作参考?

3 个答案:

答案 0 :(得分:1)

CodeCampServer使用NBehave的BDD样式“测试”。例如,这是controller test classes中的一个。

答案 1 :(得分:1)

Steve Sanderson在示例ASP.NET MVC应用程序上使用SpecFlow在BDD上写a lengthy blog post

答案 2 :(得分:1)

BDD通常特指“Given,When,Then”语法。这是SpecFlow,NBehave以及基本上支持Gherkin language的任何框架提供的样式。就是这样,

Given the system is in some state.
When I perform some action.
Then the system does x -or- is in some new state.

像MSpec这样的工具提供了所谓的“上下文规范”语法。这看起来像

(Establish your initial state... not technically a part of the grammar)
When I perform some action
It (the system) should do x -or- be in some state

此命名/语法参数之前由Herding Code podcastvarious articles上的Scott Bellware等知名人士提出。