From: Gavin Sinclair Date: 2003-01-11T09:17:58+09:00 Subject: Re: iterating in a test On Saturday, January 11, 2003, 3:51:02 AM, Paul wrote: > On Sat, Jan 11, 2003 at 01:38:09AM +0900, Martin Hart wrote: >> I believe that each assert function can take a message string which is >> dumped if the test fails: >> >> 10.times { |i| >> assert_equal(1, f(i), "Testing f where i=#{i}") >> } > This alone does not solve the whole problem; f(i) could raise an > exception, and if it does I do not know what i is. My lateral answer to this is use the debugger. If an exception is thrown, run the test in the debugger, catch the exception, wander the stack frames and explore. That's a messy "solution", but to me is justified because I rarely perform such iterative testing. Also, most of the time it will succeed, so the message is rarely necessary. Your milage probably varies. Gavin