In this post, I will briefly evalute two unit testing frameworks, namely UnitTest++ and CppUnit. Both frameworks can be used in both commercial and public projects freely. Also, they are unit tested with their own implemented unit testing capability.
First of all, from a developer perspective, CppUnit requires much more ground work to write unit tests than UnitTest++. That is the main drawback of CppUnit when compared to UniTest++.
Secondly, both test frameworks supports fixtures and different output types like XML, they have both good assert functionality. Moreover, UnitTest++ also provides time constraint based tests for execution time testing. Whereas, in CppUnit, you can measure test execution time without adding any time based constraint.
CppUnit provides some GUI based test runners for different platforms, for example MFCTestRunner can visualize unit tests written in MS VS IDE using MFC framework. However, UnitTest++ does not have any UI based visualization capability.
CppUnit has DllPlugInTester that provides a very convenient mean to run unit tests contained in a dynamic library as a post-build step . Also, our current project mainly is based on DLLs and relatively complex build system. Therefore, creating unit test DLLs to build directory where all the DLLs and EXEs of project also copied and executing DllPlugInTester application will provide us required unit test capability. On the other hand, making this tests as a post build step is another story :). Our build tool should be configured to run unit test DLLs, after building and linking completed.
Also, it is possible to implement this functionality with UnitTest++, whereas it would create lots of unit test applications in build directory. Also, it would require build tool configuration.
As you can see there are trade-offs. Therefore, if anyone asks me which testing framework is better, my answer will be "it depends!". For instance, UnitTest++ has a fast learning curve, whereas CppUnit requires some time to fully understand its capabilities. On the surface, using UniTest++ seems to be more productive and effective, on the other hand if you digg deeper CppUnit shows its features.
: Available at http://unittest-cpp.sourceforge.net/, March 2010
: Available at http://sourceforge.net/apps/mediawiki/cppunit/index.php?title=Main_Page, March 2010
: Available at http://sourceforge.net/apps/mediawiki/cppunit/index.php?title=FrequentlyAskedQuestions, March 2010