开发者

What's the best BDD framework for working with ASP.NET MVC 2 + C# 4?

开发者 https://www.devze.com 2022-12-14 16:48 出处:网络
I just heard about BDD when I watch video of Scott Guthrie in Sweden. One of listener asked question开发者_如何学JAVA to Scott about How VS2010 and ASP.NET MVC do to support BDD.

I just heard about BDD when I watch video of Scott Guthrie in Sweden. One of listener asked question开发者_如何学JAVA to Scott about How VS2010 and ASP.NET MVC do to support BDD.

After that, I search about BDD (Behavior Driven Development) that focus on specification more than unit testing when compares with TDD (Test Driven Development). I found some framework that work with Ruby and Java. But I do not any famous framework for .NET.

Please suggest me about BDD framework and summary PROs/CONs of it.

PS. Suggested BDD framework must work great on .NET 4, C# 4.0 and ASP.NET MVC 2.

Thanks,


I see this question already has an answer, and I have not tried NBehave. But, we are using MSpec (Machine.Specifications) for this fairly large Enterprise project and it is working quite well for us here. Very well worth mentioning.

Rob Conery did an EXCELLENT video on Learning BDD, where he uses MSpec, line by line: (link removed, no longer available, but search for it)

More about MSpec from Rob Conery, and why he uses it.
http://wekeroad.com/2009/09/21/make-bdd-your-bff-2/ You might also want to check out his other posts tagged BDD as well.

Pros:

  • Allows for quickly "stubbing" of your entire Story, Scenerios, Contexts, and Specifications - without any actual code. Let's you focus on the overall "Behaviors", which is the purpose of BDD!, without worry about code and making it compile.
  • Produces an EXCELLENT HTML report, with "<- NOT IMPLEMENTED" next to stubbed specifications. I often hand this report to: The Client (CEO and CTO), The Testers, New Resources I bring onto the project, and anyone else that wants to know how the software works - without me having to show a line of code!
  • TestDriven.NET runners are included with MSpec using the new tdnet linking (no setup!).
  • The [Behaviors] attribute, along with its Behaves_like delegate type, makes copying existing specifications from one scenerio over to other another scenerio a snap.

Cons:

  • Little to no documentation, even though not much is needed (watch the videos above). The author recently blogged for help on documenting.
  • Still new, and just a side-project from the author (not his main gig). But, it is very active as of this post.

Hope that helps.


I'd recommend trying SpecFlow It's weird that no-one's mentioned it. There's a great article here about using BDD with Specflow and Asp.Net MVC It's open source and is hosted on GitHub

Spec flow uses the GWT (Given When Then) syntax which I personally really like. We've had great success so far with BDD now trying to implement using SpecFlow. It's still early days yet but so far it's going well.

Pros:

  1. Integrates into VS2008 & VS2010 with a nice plugin
  2. Uses popular Given When Then vocabulary
  3. Uses standard NUnit Test Runner
  4. Feature file lets you simply paste in Scenarios from Business Analysts

Cons:

  1. the feature code behind is a little ugly, though nothing to bad
  2. As far as I know, the reporting format is fairly limited (i just use NUnit)

I encourage you to give it a go.


I built StoryQ after deciding that you didn't need much of a framework. It's very lightweight, embeds in your existing test runner, check it out at http://storyq.codeplex.com


Have you looked at NBehave? You also probably want to look at this old question. But I would also like to add that IMHO it is possible to do BDD using any kind of unit testing framework. A simple straight forward way is to name your "test class" something like "Given_X" and then let all your "test methods" have names like "It_should_Y".


Storevil

Very light weight http://code.google.com/p/storevil/


Do you know the video of Goiko Adzic on how to do BDD in plain English using Concordion.NET?

http://gojko.net/2009/09/01/acceptance-testing-in-plain-english-with-concordion-net/


Try this one: https://www.nuget.org/packages/Heleonix.Testing.NUnit It works with NUnit, but provides syntax like Jasmine or Jest in JavaScript in Given/When/Then and Arrange/Act/Assert styles

0

精彩评论

暂无评论...
验证码 换一张
取 消