From: patrick-may@... (Patrick May) Date: 2002-10-05T15:49:15+09:00 Subject: Re: assertions in Ruby "Volkmann, Mark" wrote in message news:<89539780CB9BD51182270002A5897DF602C6D6AF@hqempn04.agedwards.com>... > I'm not quite convinced that assertions should be integrated with a unit > testing framework. They seem fundamentally different to me. > > With assertions enabled, an application generally stops as soon as one > fails. Results are not collected into a report since only one failure is > reported. Assertions go in the code and remain there for documentation > purposes. > > With unit tests, tests continue even if one fails. Results are collected > into a report. Unit tests go in a separate class written exclusively for > testing purposes. RubyUnit and TestUnit assertions raise some variation of an AssertionFailedException when they are run. The test runners (or is it the suite?) rescue these, continue running, and report the results. If you do something like this (psuedocode below): class Object include Test::Unit::Assertions end class Foo def bar( float ) assert_kind_of?( Float, float ) end end Then a failed assertion will halt your execution. ~ Patrick