From: Paul Brannan Date: 2003-01-11T03:07:54+09:00 Subject: Re: iterating in a test On Sat, Jan 11, 2003 at 01:58:07AM +0900, Nathaniel Talbott wrote: > How about (untested): > > 10.times { |i| > assert_nothing_raised("Testing f where i=#{i}") { > assert_equal(1, f(i), "Testing f where i=#{i}") > } > } In this case I still have to duplicate the message for the assert_nothing_raised and the assert_equal call. What I think I'd like to see is something like this: def test_foo 10.times do |i| performing_action("Testing f(x) where i=#{i}") do assert_equal 1, f(i) some_helper_function(1) end end end def some_helper_function(i) performing_action("inside the helper function") do # make some assertions here end end The performing_action() method could append the passed string onto an array at the start of the block (and remove it at the end), so I have a list of actions that I'm in the middle of performing. This list of actions should be printed for every failed assertion and every exception that escapes. I'm not sure where to begin implementing this, though, or whether it's possible to implement it without modifying Test::Unit. Paul