I’ve been pretty “hot and heavy” with unit testing as of late. I can’t say enough about the benefits and, once you get over the learning curve, the ease with which they can be produced. Actually, I’m afraid that I sometimes border on the side of “overtesting” even but I’m guessing that aspect is something that develops with a little practice and time.
While unit testing is a great thing, sometimes things can’t really be unit tested well. Reliance on “outside” elements (such as external API calls) can make testing difficult at best and even impossible in some cases. But fear not, mock objects are an answer. I personally use DotNetMock but there are any number of solutions out there. At first, they were a bit confusing but after trying a few samples, I was able to understand their general use.
Ok, so all this long winded explanation was to present my current quandry. I’m writing a Visual Studio Add-In and would like to test it’s functionality. I have created my class which acts on a Solution object while iterating it’s Projects for various ProjectItems to utilize. So without insane amounts of setup and tear down code, how do I testing this beast?? For that matter, how would I test it even with all the code??
Shameless plug: If you’re looking for the best Unit Testing GUI out there – Zanebug is it.