
[This is actually mainly comments to Part 2] Richard wrote:
[Please do not mail me a copy of your followup]
http://legalizeadulthood.wordpress.com/2009/07/04/c-unit-tests-with-boost-te...
In this post, I will describe how to start making unit tests in C++ with Boost.Test.
I've only glanced through the parts, so I might have missed something. Also please note that my comments are very much from a TDD point of view. In Part 2, you recommend using the CHECK macros by default. Being a long-time Boost.Test user (as well as a long-time TDD:er) I strongly believe that by default one should always use the REQUIRE variety of the Boost.Test macros, for a couple of reasons: - They most closely correspond to xUnit assertions. TDD:ers are used to having their test cases aborted upon an assertion failure. - When you have multiple verifications per test[*], one of the early verifications are quite commonly some kind of precondition/guard statement which could lead to memory corruption (or simply useless further testing) if the test continues. I know you mention this as a special case in your article, but if you use REQUIRE by default you will always be safe. People will probably object to the above, saying that the want to test multiple things in the same test, and want to see the result of all "related verifications". Sorry, but I just won't buy that, because: - You really don't want to manually inspect a lot of numbers/results when TDD:ing. Seeing the name of the failing test case should be enough most of the time. - If you really need to see e.g. "x out of y" verifications fail together with their output, from a _single_ test case, this is a clear indicator that you should split that into multiple (more specific) test cases. Other than this specific thing, it looks like a good introduction to testing with Boost.Test. Just my 0.02EUR. / Johan [*] As you normally should attempt to stay out of.