Unmanaged Code Unit Testing

Living in the managed world is wonderful. But sometimes we carry a small legacy code in C++. Ok, it happens a lot. And a while back, I worked on a large application and thought – how do I introduce unit-tests there?

There’s a video posted on MSDN. It shows how to use VS Team System to test C++ COM objects. Basic stuff.

Basic indeed. Watching this video reminded me of that situation. Then we considered using a C++ framework, which didn’t work out. Code was too complicated to test. And we had VS 2005 Team System under our noses.

We know that in order to achieve better code quality, we need to make an effort. But don’t drop tools from the list, just because they don’t seem to fit at first. Today, VS 2008 Professional already has unit testing in it – use it. It got code coverage – use it. It doesn’t have all the C# and VB.Net bells and whistles – use it anyway. Any safety net is better than no net at all.

And then Integrate it into you build system. And add more tests as you continue. No more excuses.