Douglas Livingstone
4/15/2005 7:54:00 PM
On 4/15/05, Daniel Berger <djberg96@hotmail.com> wrote:
> This sparked a conversation on IRC regarding coming up with a way to
> have asserts continue even if one of them fails within a unit test. Is
> there a way to alter the behavior of test-unit so that it doesn't bail
> out on subsequent asserts if one fails?
IMO, the number of passes plus the number of fails should equal the
number of asserts, regardless of which tests fail. Phlip seems to
agree, but that there should only be one assertatin per test anyway,
so that this iregularity won't be a problem. I find that an artificial
constraint on writing unit tests, so imo tests should continue even
after a failed test.
Also, take this test:
def test_too_true
assert false, "One failed"
end
def test_true
assert false, "Two failed"
assert false, "Three failed"
end
With "break on first fail", this gives:
"One failed"
"Two failed"
Fixing "One" gives:
"Two failed"
Then you fix "Two" and it gets replaced with:
"Three failed"
In the first case, fixing a fail removed it from the list. In the
second case, it was simply replaced with something else, and the only
difference was which test the assertation was put in. It shouldn't
matter where the asserts go, the behaviour of solving something should
be that you stop seeing that it fails, nothing more need happen.
Douglas