Unit testing for C++ code - Tools and methodology

Boost has a Testing library which contains support for unit testing. It might be worth checking out.


Google recently released their own library for unit testing C++ apps, called Google Test.

Project on Google Code


Applying unit tests to legacy code was the very reason Working Effectively with Legacy Code was written. Michael Feathers is the author - as mentioned in other answers, he was involved in the creation of both CppUnit and CppUnitLite.

alt text


Check out an excellent comparison between several available suites. The author of that article later developed UnitTest++.

What I particularly like about it (apart from the fact that it handles exceptions etc. well) is that there is a very limited amount of 'administration' around the test cases and test fixtures definition.