BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Behavior Driven Development In .NET

Behavior Driven Development In .NET

This item in japanese

Bookmarks

Behavior Driven Development (BDD) is being increasingly seen as an alternative way to approach Test Driven Development. SpecFlow and NSpec are popular frameworks for BDD in .NET. They help create test specifications that are easy to read even for non-programmers and allow the design of the software to be driven by it’s purpose.

There are two main flavors to BDD – xBehave and xSpec. The first one is good mainly for High level Acceptance testing, whereas the second one is more useful for testing at a unit level. SpecFlow, which resembles Cucumber, falls in the first category, whereas NSpec (closely fashioned on RSpec) falls in the second one. Both are useful in their own ways, and it often makes sense to use both in a project - SpecFlow to cover scenario level tests and NSpec to cover detailed unit level tests.

The advantage of using something like NSpec over a Unit Test framework like NUnit or MSUnit for unit level tests is that it allows to build context incrementally, without complicating the test code. A New Look at Test Driven Development by Dave Astels also gives a very good example of how minor differences make it much easier to write more readable tests by comparing JUnit and RSpec.

There are various tutorials and samples to get you started apart from the project sites themselves.

SpecFlow and NSpec are not the only frameworks available for BDD in .NET, but they seem to be the most popular ones. There are many others like Cuke4Nuke, NBehave and MSpec, each with their own advantages and disadvantages.

BDD, an evolution of Test Driven Development (TDD), was started as an Agile practice to include QA and non-technical or business participants to participate more effectively in a software project. It extends TDD by writing test cases in a natural language in combination with Domain Driven Design to describe the purpose and benefit of code before writing it.

Have you tried Behaviour Driven Development in .NET? If so, what has been your experience?

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT