From: Eric Hodel Date: 2005-04-17T04:39:15+09:00 Subject: Re: Multiple asserts in a single unit test --Apple-Mail-10-81661996 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 14 Apr 2005, at 21:09, Daniel Berger wrote: > Hi all, > > I came across an article regarding unit testing philosophy that I > thought was interesting: > > http://weblogs.asp.net/rosherove/archive/2005/04/14/ > AvoidMultipleAsserts.aspx > > 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? Something builtin to test-unit > or a simple hack? > > Any opinions on multiple asserts within a single unit test? Any > opinions on what the default behavior should be for test-unit with > regards to multiple asserts where one fails? I prefer having multiple tests per method, each testing some other path through the method. This seems to be a workable alternative (for me!) to continuing despite failures. I feel I get the same amount of information regarding potential failure points that the continue method gives. It also encourages me to write shorter tests because continuing could lead to tests that are too long. -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --Apple-Mail-10-81661996 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iEYEARECAAYFAkJhacwACgkQMypVHHlsnwTyKgCbBpTJSQItkTRMZfKshqnZ6UCP DjgAoPT4ov34LNfa1rUmcbSuuT4t8toX =iPIt -----END PGP SIGNATURE----- --Apple-Mail-10-81661996--