Boost logo

Boost :

Subject: Re: [boost] [Boost.Test] Assertion changes in trunk? [WAS: Call for Review: Boost.Test documentation rewrite]
From: Alexander Lamaison (awl03_at_[hidden])
Date: 2014-01-24 05:58:18


legalize+jeeves_at_[hidden] (Richard) writes:

> [Please do not mail me a copy of your followup]
>
> Alexander Lamaison <awl03_at_[hidden]> spake the secret code
> <868uu8nv96.fsf_at_[hidden]> thusly:
>
>>As 'CHECK' is the assertion level you should use by default, [...]
>
> I don't know why you would say that when it is contrary to accepted
> unit testing practices and the behavior of assertions in other
> testing frameworks in every other language otu there.

Tests cases should test one, and only one, logical concept each.
Therefore, multiple assertions in the same tests case will all be
testing the same concept. In other words, they are, together,
constructing a report of the failure.

Often this is possible using only one assertion, in which case CHECK and
REQUIRE are equivalent, but sometimes more than one
non-mutually-exlusive assertion is needed to give the full picture.

> For instance, jUnit doesn't continue executing the test past the first
> failed assertion. Neither do unit testing frameworks in JavaScript or
> Python or PHP, etc.

Their loss ;)

Seriously though, I find it helps to have multiple bits of data included
a single test cases's failure report. It maximises my chances of
getting the case to pass next time, which is important in C++ where
there is compilation step in between to slow down the test-edit-test
loop.

Alex

-- 
Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org)

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk