Ramping Up .Net For BDD and Unit Testing With Gallio, NBehave, and Moq
Posted Wednesday, March 19th, 2008 by Michael HerndonUnit Testing is a word that has inspired some or has become a bane for others. TDD, test driven development, has changed the way many people write their code, and others… not so much. Then a new catch phrase appeared on the test scene, BDD, behavior driven development. So instead of tests, you’re writing specifications of expected behaviors and observations in code, that will also hopefully create your specifications documentation for you. Also there is this notion of doing story boards as well.
Ruby has Rspec built ontop of a well oiled web application framework known as Rails. So where does leave .Net developers, especially with the Asp.Net Mvc Option/framework on the horizon? I’ve been keeping an eye on .net tools that would allow or be the Rpec for .net. Things like NSpec and NBehave popped up on Google, but there was really no documentation, read me’s or even blog postings to demonstrate how to use these libraries. However a cool mock library named Rhino mock became the rage to heal the pain of NMock (but geeze man, all that "Replay" stuff is confusing, totally ignoring the KISS principle). And MbUnit, a unit testing on crack, which built on top of other Xunit frameworks, seemed to be stagnated.
Enter 2008, the year of open source and openness for developers of .Net. MbUnit has been hard at working on Gallio, the neutral test platform, NBehave has merged with Nspec and Behave# and have an April 4th release date, but you can still play with the bits. Even Microsoft is doing the release often and having open input on the Asp.Net Mvc framework. A new cooler mock framework has come out known as Moq that uses the c# 3.0 extensions and lambdas, which Scott Hanselman gave a great overview about.

