I’ve been using CppUnit for quite a while now (and am happy with it). As we are using more and more parts of the boost library I had a short look on boost.test and I’m wondering now if I should switch to boost.test in a new project or not.
Can anyone here tell me about the differences between the two frameworks and the benefits (if there are any) of using boost.test?
Do yourself a favor and go straight to Google Test, which makes CppUnit and
boost::unit_testlook clunky and repetitive.For example, say you have a simple fixture:
To add a test to your fixture, write it!
That’s all you need. Notice the lack of explicit testsuite declarations or a separate agenda that repeats all your tests’ names.
Compile it as in
and run your test to get
(Run it yourself to see the nice green text for passing tests!)
This is only the beginning. Take a look at the Google Test primer and the advanced guide to see what else is possible.