.NET 的黄瓜替代品

发布于 2024-07-24 18:02:46 字数 77 浏览 0 评论 0原文

快说一下,有没有人在 .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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

┼── 2024-07-31 18:02:46

您还应该查看 SpecFlow,这是一个使用 .NET 执行 BDD 的开源项目。

SpecFlow 使用相同的定义格式 (Gherkin),例如 cucumber,但您可以在 .NET 中编写步骤定义。 它基本上从您的功能文件生成单元测试类(NUnit、MsTest、xUnit 等),因此您可以使用相同的单元测试执行引擎,就像使用真正的单元测试一样。 这样,也可以更轻松地将 BDD 功能测试集成到集成构建中。

在最新版本中,SpecFlow 具有针对 Visual Studio 2010 的语法着色功能,并支持 Silverlight 和 Mono/MonoDevelop。

更新 3/8/2024: 经过 14 年的历史,我们不得不使用新名称重新启动(分叉并重命名)SpecFlow 项目:Reqnroll。 Reqnroll 与 Cucumber 团队密切合作,现在将成为 Cucumber 的官方 .NET 实现。 您可以在 公告帖子

You should also check out SpecFlow, that is an open-source project to do BDD with .NET.

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.

In the recent versions SpecFlow has a syntax coloring feature for Visual Studio 2010 and support for Silverlight and Mono/MonoDevelop.

Update 3/8/2024: After 14 years of history we had to reboot (fork & rename) the SpecFlow project with a new name: Reqnroll. Reqnroll works closely together with the Cucumber team and will now become the official .NET implementation of Cucumber. You can find more info on the reboot in the announcement post.

べ繥欢鉨o。 2024-07-31 18:02:46

Sure. It's called Cucumber. There's an example for how to test .NET code in the Cucumber examples directory and documentation on the Cucumber Wiki for both .NET and Mono.

贱贱哒 2024-07-31 18:02:46

这个空间似乎有 3 种可能性:

  1. 使用 Cucumber 和 IronRuby。 这里有一篇博客,介绍了一些步骤开始使用这个。 缺点似乎是性能。 我读过一些帐户说它总体上较慢,而其他人则说它只是旋转速度非常慢。 但这还远非定论,因为 IronRuby 仍在积极开发中。

  2. 使用Cuke4Nuke。 我曾多次听说该产品被推荐。 它实际上使用常规的 Ruby 和 Cucumber,但通过服务器运行您的 .NET 代码。 幸运的是,当您使用它时,所有这些复杂性都是透明的。 Cuke4Nuke 不再处于积极开发阶段。

  3. 使用SpecFlow。 这是 Cucumber 的 .NET 端口。 正因为如此,它可能不具备 Cucumber 的所有功能,并且可能还有额外的功能。 好处是您不必安装 Ruby。

目前似乎还不清楚哪一个是最佳选择。 就我个人而言,我计划从 Cuke4Nuke 开始。

There seem to be 3 possibilities in this space:

  1. Use Cucumber and IronRuby. Here's a blog on some steps to get started with this. The downside seems to be performance. I've read accounts that say its slower in general, and others that say it's just really slow to spin up. This is far from conclusive though, since IronRuby is still in active development.

  2. Use Cuke4Nuke. I've heard this product recommended a few times. It actually uses regular Ruby and Cucumber but runs your .NET code through a server. Fortunately, all that complication is transparent as you are using it. Cuke4Nuke is no longer under active development.

  3. Use SpecFlow. This is a .NET port of Cucumber. Because of this, it may not have all of Cucumber's features, and it may have extra features. The nice thing is you don't have to have Ruby installed.

At this time it doesn't seem clear which of these is the best option. Personally I'm planning on starting with Cuke4Nuke.

吹泡泡o 2024-07-31 18:02:46

简单英语的 BDD可以通过 Concordion.NET 完成。 预期行为的规范是用 HTML 编写的。

任何结构的任何句子都可以用于 Concordion.NET 测试。 例如,不必写“给定一个余额为10美元的银行账户,当发起20美元的提款时,交易失败”这样的句子。 相反,可以使用任何类型的句子,例如“如果帐户中没有足够的 10 美元余额,则 20 美元的交易失败”。

Concordion.NET 测试是在 NUnit 的帮助下执行的,NUnit 集成在许多不同的环境中:https://github .com/concordion/concordion-net

BDD in plain English can be done with Concordion.NET. The specifications of the expected behavior are written in HTML.

Any sentences of any structure can be used for Concordion.NET tests. For example it is not necessary to write a sentence such as "given a bank account with a balance of 10$, when a withdrawal of 20$ is initiated, the transaction fails". Instead any type of sentence could be used such as "a transaction of 20$ fails, if the account contains not enough balance of 10$".

Concordion.NET tests are executed with the help of NUnit, which is integrated in many different environments: https://github.com/concordion/concordion-net

做个少女永远怀春 2024-07-31 18:02:46

StoryTeller 虽然不是严格意义上的 BDD,但还是有一定的相关性。 它似乎支持某种不同类型的测试,但是用 .NET 编写的。
阅读Jeremy Millers 博客了解更多信息

StoryTeller is somewhat related even though it is not strictly BDD. It seems to support a somewhat different kind of test but is written in .NET.
Read more on Jeremy Millers blog

肤浅与狂妄 2024-07-31 18:02:46

我写了一篇博客文章,详细介绍了使用 IronRuby 运行 Cucumber 的过程: http://hotgazpacho.org/2009/06/cucumber-and-ironruby-it-runs/

I wrote up a blog post detailing the process I followed to get Cucumber running with IronRuby: http://hotgazpacho.org/2009/06/cucumber-and-ironruby-it-runs/

巾帼英雄 2024-07-31 18:02:46

还有StoryQ。 这是一种以开发为中心的用户故事方法,可以向客户报告。 http://storyq.codeplex.com

StoryQ 是一个适用于 .NET 3.5 的可移植(单个 dll)嵌入式 BDD 框架。 它在您现有的测试运行程序中运行,并有助于生成人性化的测试输出(html 或文本)。 StoryQ 流畅的界面为您的 BDD 语法添加了强类型、智能感知和文档。

There is also StoryQ. This is a dev focussed approach to user stories that can report back out clients. http://storyq.codeplex.com

StoryQ is a portable (single dll), embedded BDD framework for .NET 3.5. It runs within your existing test runner and helps produce human-friendly test output (html or text). StoryQ's fluent interface adds strong typing, intellisense and documentation to your BDD grammar.

£冰雨忧蓝° 2024-07-31 18:02:46

我有一篇文章展示了如何在 C# 中使用 Cucumber,位于 http://blog.webintellix.com/2009/10/how-to-use-cucumber-with-net-and-c.html IronRuby 1.0 的运行时间得到了显着改善。

I have an article showing how to use Cucumber with C# at http://blog.webintellix.com/2009/10/how-to-use-cucumber-with-net-and-c.html The run times have improved dramatically with IronRuby 1.0.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文