When I work on an article, or a newsgroup answer, I often find myself writing little bits of code to tinker with the framework. Sometimes I just want to try out a scenario before I write up a theory as fact. Other times I just want to see what happens in edge cases through observation instead of digging into a spec or decompile code with Reflector. I’ve found this is a good way to clarify grey areas of documentation.
Many times these little code snippets live inside a project in a temp directory with the name of ConsoleApplication9 or something along those lines, and they eventually end up in the recycle bin. Then tonight it finally hit me on the head with a thud – I should use NUnit, and formalize these snippets into something useful - an ongoing work of tests and experiments.
Now, whenever a new version of the framework arrives, be it a major release or a maintenance / bug fix release, I can execute the tests and see what has changed or been fixed.
I can see a potential benefit for authors who will want to update a work for future versions of the framework. By codifying a book’s descriptions of framework behavior into unit tests, an author can spend less time reading the “What’s new” section of the framework documentation. When combined with unit tests for all the sample code, the turnaround time for revision could be much quicker, which makes both author and editor happy people.
In this community of bright people, I’m sure someone has already thought of this. Maybe there is already a book out about TDP and I just don’t know about it.
Speaking of books, I’ve also been eyeing the book ‘TDD in Microsoft .NET’ as a potential purchase. Steve Eichert has a positive review, and I’m wondering what Marcie Robillard thinks of the book. All of my TDD knowledge has been built from conference and magazine material, so it would be nice to have a more comprehensive and detailed source of information.