From: ahoward Date: 2003-01-28T03:38:13+09:00 Subject: Re: Test::Unit -> order of tests? On Tue, 28 Jan 2003, Chad Fowler wrote: > I humbly disagree with this. If the order of the tests is guaranteed, it > would promote temporal coupling between the test cases. It's better to let > each "test..." method stand alone without dependencies on the other methods. this may be true _most_ of the time, but there are cases where it's too inconvenient to decouple tests from their order, for example, i have a test suite for a singleton class which manages a bitemporal database stored in postgresql. the api performs certain operations and expected the database to be in a certain state after each one. the only way to decouple this particular test from time would be to tear down, and re-import, the database in the 'setup' method and then perform tests 0 though (n - 1) for each test n. currently my suite is 2000 lines long and takes 4 minutes to run; if i followed you approach this suite would balloon to around 10000 lines and take a _very_ long time to run. this simply is not pratical in all cases. -a > > Chad > > On Tue, 28 Jan 2003, ahoward wrote: > > > On Tue, 28 Jan 2003, Michael Garriss wrote: > > > > > IMHO, it would be nice if they were run in the order they were defined. > > > > agreed. > > > > > > > > -mike > > > > > > ahoward wrote: > > > > > > >On Tue, 28 Jan 2003, Mauricio Fern�ndez wrote: > > > > > > > > > > > > > > > >>I'm new to Unit Testing and wanted to learn on it by writing the tests for a > > > >>cheap file-transfer protocol. There's some hand-shaking involved at the > > > >>beginning which _needs_ to be done before anything else. The problem is I'd > > > >>like to test that too, but I don't know if I can rely on any order in the > > > >>execution of the tests. OTOH, I don't know if it's OK to do everything in > > > >>#setup and do the assertions right there. > > > >> > > > >> > > > > > > > >i had a similar problem. nameing your tests in a manner which sorts lexically > > > >seems to work, eg : > > > > > > > > def test_a_whatever > > > > ... > > > > end > > > > > > > > def test_b_whatever > > > > ... > > > > end > > > > > > > >-a > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ahoward@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ====================================