Is there a way to wrap setup and teardown methods around an entire suite? I haven't seen explicit methods for this purpose, but maybe there's an idiomatic way to achieve the same result.
Michael
-- Michael Schuerig The more it stays the same, mailto:mich...@schuerig.de The less it changes! http://www.schuerig.de/michael/ --Spinal Tap, The Majesty of Rock
On Jun 10, 2005, at 13:50 , Michael Schuerig wrote:
> Is there a way to wrap setup and teardown methods around an entire > suite? I haven't seen explicit methods for this purpose, but maybe > there's an idiomatic way to achieve the same result.
This is late, but here's something that will work:
require 'test/unit'
class T < Test::Unit::TestCase def setup p 'setup' end def teardown p 'teardown' end def test1 p 'test1' end def test2 p 'test2' end def self.suite s = super def s.setup p 'suite_setup' end def s.teardown p 'suite_teardown' end def s.run(*args) setup super teardown end s end end
I do plan on providing a better way to do that, but for now we can just lean on the extreme flexibility of Ruby.