From: Mike Campbell Date: 2003-05-20T21:47:29+09:00 Subject: Re: Test cases dependencies? Generally, this is considered a bad thing, since tests are supposed to be atomic and independent. That said, there are ways around it with having your test methods call other, non-test methods in whatever order you need. > -----Original Message----- > From: Laurent Sansonetti [mailto:laurent@datarescue.be] > Sent: Tuesday, May 20, 2003 4:00 AM > To: ruby-talk ML > Subject: Test cases dependencies? > > > Hi rubyists ;-) > > Is it possible to create dependencies between ``test_'' methods, in a > Test::Unit::TestCase object? > > For instance, imagine the following: > > # Tests the ``foo'' library. > require 'test/unit' > class TC_foo < Test::Unit::TestCase > def test_init > # Test if the foo library can be initialized. > end > def test_bar > # Test the ``bar'' method of the foo library. > # This test requires that the library was > # correctly initialized before. > end > end > > If I run this sample, Test::Unit will firstly execute ``test_bar'', and > secondly ``test_init'', because ``bar'' cames before ``init'' in the > alphabetical order. > > I would like that ``test_bar'' depends of ``test_init''. > > Any ideas? > > -- > Laurent >