March 29, 2010

Test Driven Development in Visual Studio 2010

By all accounts, I’m not a developer.  Not “really” a developer anyway.  I do code, when needed and I find that I can articulate my code with decent patterns if not syntax when I do.  A project I am currently working on, in fact, is heavy coding.  Fortunately, I have a great colleague that is patient with me as I pick up C# over my beloved VB.Net (sorry @BethMassi).  I was excited to teach my colleague something the other day about Test Driven Development that I’ve used for quite some time and am really impressed by the baked in features of TDD inside of Visual Studio 2010.

When I write something new, I try to create all of my unit tests first, before a single line of logic towards the program is created.  This isn’t always practical, but it certainly helps.  The reason I chose to go this route was that when I’m done with my test project, large chunks of that code drop in to the methods and functions that go in to building up the design of the new whatever.  The remaining code is then quickly and easily changed to Asserts such that I now have a good clean design with good separation of concerns.

If you are interested in TDD, there are scads of resources on the Internets, but I have found a great TDD article on MSDN that speaks directly to the features of VS 2010 and is not to be missed.  You can find that article here.  Kudos to the Brits!