I like Test Driven Development (TDD). It makes sense to me at a conceptual level, it feels right,and it basically formalizes a number of practices I have had for years (but without the discipline to necessarily do it the same way all the time). I think itleads to better software both through finding defects earlier and because it changes the way you approach coding in a good way that makes you think about the client API very closely up front (because your tests are client code).
The one thing I don’t like or really just haven’t gotten my arms around yet is how to really apply it comprehensively across all the kinds of development I do. For business objectsthat encapsulate some data and expose operations on that data, TDD is perfect and easy to understand. For things like asynchronous, event-driven services and interactive UI code, I still have a hard time figuring out how to apply TDD.
So when I finally got around to reading the latest MSDN, I was looking forward to the article in thereon TDD. I found the article to be well written and thought it did a great job explaining the basics and how to put together TDD test fixtures in .NET and work with NUnit. I was a little dissatisfied with the finish though.
As I read, I started salivating as I got to the section titled “Using TDD in the Real World”. Cool, someone is finally going to go beyond talking about money classes as demonstrate using TDD for something hard… or maybe not. Then it started talking about addressing GUI testing, even better… or maybe not. In the end, the “real world” scenario ended up being a combo box driven by a simple data container class for countries, and the only thing that TDD was demonstrated against was the country list class. Hardly a real world scenario, and how you might test the combo box that uses it was quickly slipped around.
Does anyone out there have any good resource links to using TDD for GUI and/or asynchronous/event-driven scenarios? That is the one area I still need a better clue, but I can’t seem to find any good examples or discussion of them.