问题描述
快速,有没有人在 .NET 领域遇到过类似于 Ruby 的 cucumber(一种人类可读的 DSL,用于定义可以测试的用例故事)的库?
Quick one, has anyone come across a library similar to Ruby's cucumber (a human readable DSL for defining use case stories that can be tested against) in the .NET sphere?
推荐答案
你也应该看看 SpecFlow,那个是一个使用 .NET 进行 BDD 的开源项目.
You should also check out SpecFlow, that is an open-source project to do BDD with .NET.
SpecFlow 使用相同的定义格式 (Gherkin),例如 cucumber,但您可以在 .NET 中编写您的步骤定义.它基本上从您的功能文件中生成单元测试类(NUnit、MsTest、xUnit 等),因此您可以使用相同的单元测试执行引擎,就像使用真正的单元测试一样.这样也更容易将 BDD 功能测试集成到集成构建中.
SpecFlow is using the same definition format (Gherkin), like cucumber, but you can write your step definitions in .NET. It basically generates unit-test classes (NUnit, MsTest, xUnit, etc.) from your feature files, so you can use the same unit test execution engine, like you do with the real unit tests. This way it is also easier to integrate the BDD functional tests to the integration build.
在最近的版本中,SpecFlow 为 Visual Studio 2010 提供语法着色功能,并支持 Silverlight 和 Mono/MonoDevelop.
In the recent versions SpecFlow has a syntax coloring feature for Visual Studio 2010 and support for Silverlight and Mono/MonoDevelop.
这篇关于.NET 的黄瓜替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!