tags:

views:

2161

answers:

7

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?

+8  A: 

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.

Jörg W Mittag
I attempted this, but kept hitting a bump with running the ICucumber wrapper. The message I got said that the .yml config file was missing.
Owen
Tried everything described here as well: http://thomaslundstrom.blogspot.com/2009/03/on-getting-started-with-using-cucumber.html
Owen
I'm guessing you are referring to this message: "cucumber.yml was not found. Please refer to cucumber's documentation on defining profiles in cucumber.yml. You must define a 'default' profile to use the cucumber command without any arguments. Type 'cucumber --help' for usage. (Cucumber::Cli::YmlLoadError)", right? The obvious question, when a program complains that it couldn't find a file is, is the file actually there or not? Because, if the file is not there, then the reason why it couldn't be found is kind of obvious ...
Jörg W Mittag
Yes, the file is there. And the link example I posted suggested that the cucumber wrapper was looking in IronRuby's gem folder and not rubys one despite the explicit instruction not to. I did as was suggested and copied the files to my IronRuby's gem folder and nothing. The path in the error looks right, and the file seems to be there. I gave up on this after a few hours of pain.
Owen
I still don't quite get what you mean. The link you posted has absolutely nothing whatsoever to do with your problem. And what do you mean by "the file *seems* to be there"? You wrote the file, you saved the file, you should *know* whether it is there or not!
Jörg W Mittag
+2  A: 

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/

Will Green
Ill give it a run through and get back to you.
Owen
I'm also working on porting win32console to IronRuby so that we can get colored console output like we do in MRI: http://github.com/hotgazpacho/ironruby-win32console/
Will Green
+13  A: 

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.

Gaspar Nagy
Nice, looks great. Thanks
Owen
+3  A: 

Cuke4Nuke is getting a lot of attention with the people I know:

Randy Eppinger
Here's a recent blog post that helps with using Cuke4Nuke.http://gojko.net/2010/01/01/bdd-in-net-with-cucumber-cuke4nuke-and-teamcity/
Randy Eppinger
+4  A: 

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.

  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.

Kevin Berridge
A: 

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

Johan Bergens
A: 

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.

todd