Sunday, October 3, 2010

It was a busy summer

This last summer I spent time getting embedded in a new group at work.  It's been a blast because the group is really enthusiastic about agile development and adopting new and efficient practices.  I've had a chance to practice a lot of the things I've been doing and studying in my free time including acceptance test driven development, NHibernate, ASP.NET MVC 2 and lots more BDD.

There's nothing sweeter than having a greenfield project and I was able to get my hands on one.  I was tasked with building an internal dashboard for some of our back end (Windows) services.  I'm still in .NET land and we're primarily a Microsoft shop so I used a pretty small but flexible stack,

For testing, I tried out doing acceptance test driven development with SpecFlow which is the .NET analog to Ruby's Cucumber.  My unit/integration testing framework of choice is still MSpec.

I took this experience and made a presentation to the company about BDD.  For anyone that's looked around the web at BDD presentations you won't be incredibly surprised by the content.  Lots of the same points are made and I even borrowed the excellent high gear/low gear analogy of ATDD I found in someone else's presentation (I can't remember who :-(...sorry, uncredited person, whomever you are).  You can download it from my dropbox here.

I know I promised an example of doing ATDD and I'd really like to do it.  Now that work is semi-calm I can try to whip something up.  There are tons of other things I want to talk about like the Java codebase I'm working in now, when NOT to unit test, the current .NET craze around CQRS, and other interesting topics swimming around in my head.  

2 comments:

dalesmithtx said...

Hey Nick,

Could you point out how to integration the MSpec BDD stuff in with test runners from NUnit, ReSharper, and TestDriven.net?

Thanks,
Dale

Nick Swarr said...

Out of the box, MSpec has a handful of batch files for registering with TestDriven.net and Resharper. Once you run the batch file for your testing tool of choice then you'll get the text editor support for running tests inline.

When I run a build (using NAnt, Rake, whatevs), it's not quite as seamless. There is a console runner for MSpec for executing the tests. I have a test targets that have to shell out two calls; once to the NUnit test runner and again to the MSpec runner.

The MSpec runner is neat because I can generate an HTML report on the tests that's human readable. Check out the Search Dashboard trunk build for some of the output being generated by the tests.

SpecFlow generates files that are decorated with NUnit attributes so that's run directly by the NUnit console runner.