Skip to main content

Unit testing

I've lately switched my unit testing suite from Boost.Test over to UnitTest++ (written by the friendly guys at Games from within). Compared to Boost.Test, it's much easier to use and works fine out of the box.


Unlike Boost.Test, UnitTest++ does not require manual setup of test suites. It's enough to put each test into a TEST block and it will be added automagically to the global suite. On the mailing list there has been recently some discussion about added real test suites to UnitTest++, but the current system is already very useful. Actually, I don't get the point about test suites, but somehow many developers are stuck into trees and such and are willing to sacrifice development speed just for pretty output. A note output UnitTest++'s output, it's very similar to the compiler output and allows you to jump directly to a failed test (it jumps even directly to the failed check and not the full test!). There's also XML based output and more, but the basic output is fully sufficent for me. Moreover, with the basic output, the test suite runs really fast (currently 0.00 secs for my small 11 test ;) ). I'm about to integrate the test suite directly into the build process so that a failed test will show up directly. Needs a bit polish on the build side at the moment (the test suite is currently totally separated from the rest of niven), but I'm pretty confident I'll be done with it this weekend.