Sunday, May 15, 2011

(Win)Unit Test Native Code

Came across a tool called WinUnit, from Microsoft, for unit testing native (unmanaged) C/C++ code on windows through an article "Simplified Unit Testing for Native C++ Applications" by Maria Blees.

Introduction
As per CodePlex, WinUnit is:
.NET languages have great unit testing tools such as NUnit or MSTest, but native C/C++ developers have fewer and less convenient options. WinUnit is a project that brings NUnit-like testability directly to native code. With WinUnit, you focus on just your test code and WinUnit takes care of the rest. It comes with a complete library that makes creating tests simple, and a runner program to run them.
WinUnit Vs BOOST Vs CPPUnit
BOOST.Test and CPPUnit were couple of other widely known/used tools. There are lot other existed but WinUnit was picked among all, with one main reason - No test runner to be implemented. One can focus only on writing tests without bothering about the test runner and that reduces (considerable) coding effort too.

Some of the advantages in using WinUnit are:
  • Writing Tests and running them are made easy.
  • Integration with Visual Studio is easy and includes macros to setup your projects to use WinUnit. Also, to run tests.
  • No separate test runner is required comparing with other BOOST.Test/CPPUnit tools.
  • Also, code coverage statistics (% or Count of lines covered or not covered) can be generated easily as if NUnit/MSTest does in .Net Applications.
Downloads
Binaries and Samples are @ http://winunit.codeplex.com/
Source is @ http://msdn.microsoft.com/en-us/magazine/cc164218.aspx

No comments :

Post a Comment