Cucumber alternative for .NET

.NetCucumber

.Net Problem Overview


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?

.Net Solutions


Solution 1 - .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.

Solution 2 - .Net

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.

Solution 3 - .Net

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.

Solution 4 - .Net

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

Solution 5 - .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

Solution 6 - .Net

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/

Solution 7 - .Net

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.

Solution 8 - .Net

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionOwenView Question on Stackoverflow
Solution 1 - .NetGaspar NagyView Answer on Stackoverflow
Solution 2 - .NetJörg W MittagView Answer on Stackoverflow
Solution 3 - .NetKevin BerridgeView Answer on Stackoverflow
Solution 4 - .NetJohan BergensView Answer on Stackoverflow
Solution 5 - .Netuser3632158View Answer on Stackoverflow
Solution 6 - .NetWill GreenView Answer on Stackoverflow
Solution 7 - .NettoddView Answer on Stackoverflow
Solution 8 - .NetrupakgView Answer on Stackoverflow