From: Henrik Horneber Date: 2004-11-16T01:33:20+09:00 Subject: Re: Starter question on Test::Unit > > I am confused about the '.' before the on second output 'in setup'. > what does that '.' mean? > Oh, that's just the ConsoleRunners' way of saying a test has succeeded. > Going back to my original example. > If I want to use @foo, @run, @rerun (already initiated) in #test_rerun, > what should I do? > You could put both asserts in one test_function. There is no rule saying you can only have one assertion per test function. Don't know if this is feasible in your environment/setting though. For example: class TestClass < Test::Unit::TestCase def setup @foo = Foo.new @run = Foo.run(@foo.key) @rerun = Foo.rerun(@run.key) end def test_foo_runs assert_equal(@foo.key, @run.key) assert_equal(@run.key, @rerun.key) end end > Or, is there any convention something like, #setup_run (would be used by > only #test_run) or #setup_rerun (would be used by only #test_rerun) Not that I know of (which more or less doesn't mean anything). But since only test_* methods get called from the test framework and TestClass otherwise is a perfectly fine 'regular' class, you could write your own setup_rerun method and call it from within your test function before calling assert. But somehow I get the impression that this will result in pretty bad code duplication or bloated test functions. IANATDE ( I am not a test design expert ) :) Henrik