I'll Be Sticking to NUnit Thanks
I've recently been playing with the Visual Studio 2005 betas, including the new unit testing framework that they have included. First impressions with this sort of new offering are always big with me... and my first impression was that it sucks... and sucks royally. That's a bold statement I know. The reason I say this is because it is missing one huge, gigantic, extremely important feature that NUnit has. NUnit allows you to inherit from a test class, and Visual Studio doesn't... and won't for the first release according to this bug report on Microsoft's site.
Why would you want to do this anyway? Allow me to paint the picture. If you're like me, you were hugely disappointed with Microsoft's initial offerings of collections. Hashtable and ArrayList just aren't enough for some of us. What about Binary Search Trees, and Skip Lists? What about a Set class? Being the good general purpose developer that I am, I wrote my own. I also decided that in order to make them easily usable among my peers, I made sure that they conformed to the standard Microsoft collection interfaces, like IDictionary. Also being the good general purpose developer, I wanted to write unit tests that fully tested my new collection classes... but I didn't want to write a separate test for each of my new classes. After all, if all my collections implement IDictionary, I should be able to just write one test that runs against IDictionary, and then create simple classes that inherit from that big one, and simply create the specific collection to test against in the inherited class... which is exactly what I did. It's a rather big test class too which not only tests the basic functionality, but also tests all the out of bounds cases for the IDictionary methods, and the border cases too.
So naturally, when I got a hold of the betas of Visual Studio 2005, I migrated my collection classes over, and improved them to use the new capabilities of generics. I also migrated over my NUnit test cases to use the new unit testing functionality built in. I find it strange that a tool, which promotes good Object Oriented design and programming practices would not allow you to use those same practices for unit testing that code. This was the very first thing I tried to do... and it failed miserably. You simply aren't allowed to do it in the first version. I think this is a huge mistake by Microsoft.
Why would you want to do this anyway? Allow me to paint the picture. If you're like me, you were hugely disappointed with Microsoft's initial offerings of collections. Hashtable and ArrayList just aren't enough for some of us. What about Binary Search Trees, and Skip Lists? What about a Set class? Being the good general purpose developer that I am, I wrote my own. I also decided that in order to make them easily usable among my peers, I made sure that they conformed to the standard Microsoft collection interfaces, like IDictionary. Also being the good general purpose developer, I wanted to write unit tests that fully tested my new collection classes... but I didn't want to write a separate test for each of my new classes. After all, if all my collections implement IDictionary, I should be able to just write one test that runs against IDictionary, and then create simple classes that inherit from that big one, and simply create the specific collection to test against in the inherited class... which is exactly what I did. It's a rather big test class too which not only tests the basic functionality, but also tests all the out of bounds cases for the IDictionary methods, and the border cases too.
So naturally, when I got a hold of the betas of Visual Studio 2005, I migrated my collection classes over, and improved them to use the new capabilities of generics. I also migrated over my NUnit test cases to use the new unit testing functionality built in. I find it strange that a tool, which promotes good Object Oriented design and programming practices would not allow you to use those same practices for unit testing that code. This was the very first thing I tried to do... and it failed miserably. You simply aren't allowed to do it in the first version. I think this is a huge mistake by Microsoft.