This post originated from an RSS feed registered with .NET Buzz
by Eric Gunnerson.
Original Post: Unit testing and TDD
Feed Title: Eric Gunnerson's C# Compendium
Feed URL: /msdnerror.htm?aspxerrorpath=/ericgu/Rss.aspx
Feed Description: Eric comments on C#, programming and dotnet in general, and the aerodynamic characteristics of the red-nosed flying squirrel of the Lesser Antilles
Unit testing works well for class libraries, especially ones that act fairly statically.
If you create one of these, you should be writing unit tests
Unit testing is hard with graphical applications and/or dynamic applications. I have
an app that I'm writing that uses multiple threads, fires events asynchronously, and
is peer to peer. There aren't any unit tests for that section yet.
Unit testing is great for tricky code that you wrote but weren't sure that it really
worked. I updated my Regex Workbench a while back,
and in the process wrote unit tests for all the code that I have that interprets regular
expressions to english. I found one feature I hadn't implemented, and two that were
implemented incorrectly. I'm now much more confident that it works.
I'e also been playing with Test-driven development. I'm not sure about it yet, though
it is true that if you write the tests up front, you're much more likely to write
them.