All entries for Sunday 16 April 2006

April 16, 2006

Behavior Driven Development: BooSpec

This weekend is watched this video I then spent a lot of time exploring a relatively new concept in the agile development world: Behavior Driven Development (BDD).

RSpec is a Ruby project to allow creation of runnable specifications. There is a related project for .NET called NSpec

I have also been exploring Boo , a cool new language targeting .NET. Whilst NSpec allows the creation of runnable specs, I don't like the slightly clunky syntax imposed by C#. I want my spec to be as human readable as possible. Basically we need extension methods in C#. These are coming in 3.0, but for now I thought I'd look at Boo. Boo allows me to more closely approximate RSpec's Ruby syntax, giving rise to Boo specs like this:

namespace Test

import BooSpec

class EmptyStack:
private stack as Stack

def SetUp():
stack = Stack(10)

def CountIsZero():

def PopThrowsException():
{ stack.Pop() }.Must().Throw(typeof(IllegalOperationException))

def PushedItemIsOnTop():

I especially like "{ stack.Pop() }.Must().Throw(typeof(IllegalOperationException))". It's just so succinct!

I'm tempted to start a new project called "BooSpec". This would be a library similar to RSpec and NSpec, but written in Boo. The BooSpec library could be used by any .NET language, except the Must() extension methods calls would have to revert to normal static calls. Of course there is nothing wrong with writing the spec in Boo and the application code in C# or VB.NET!

Google Ads

Search this blog

Most recent comments

  • I scratched my eye while i was holding some kind of plastic packaging.. Anyways the corner of the pl… by Ercan on this entry
  • About a year ago my contacts that i was wearing, i guess were fautly, because shortly after they wer… by Jon on this entry
  • I got shower gel in my eye 4 and a half days ago, and becasue i rubbed my eyes a lot, i have scratch… by Chris on this entry
  • This website may help–health/tc/Eye–Injuries–Home–Treatment by S on this entry
  • I somehow got dirt, or debris in my eye. The terrible pain sent me in a tailspin. I was afraid of sa… by Bobbi on this entry


April 2006

Mo Tu We Th Fr Sa Su
Mar |  Today  | May
               1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30


Blog archive

Not signed in
Sign in

Powered by BlogBuilder