From: Gavin Sinclair Date: 2003-02-07T12:10:53+09:00 Subject: Re: Return values from assertions On Friday, February 7, 2003, 2:01:41 PM, Matt wrote: >> Therefore, failures and errors highlight different problems in the >> code, and this is a practical difference. > Even more to the point, I don't see a point to RubyUnit's > assert_no_exception or Test::Unit's assert_nothing_raised. > Conceptually, you're saying "this code shouldn't raise an exception > that is not handled" but that is pretty much universally true. I see a point. It enables you to unit-test an operation that doesn't return anything, but which raises an exception on failure. You could just call it and let it be an error instead of a failure, but assertions are a good way to document what you're testing. It would perhaps be better to specify which exceptions are "expected", because obviously you can have some sort of run-time exception that you didn't expect, and should be informed about. I've done this a few times: begin method_to_be_tested rescue ApplicationSpecificException fail "..." end Gavin