From: ahoward Date: 2003-05-16T00:34:48+09:00 Subject: Re: Test::Unit sequencing On Thu, 15 May 2003, [iso-8859-1] Anders Bengtsson wrote: > Hi Brian, > > "The first rule of unit testing is, don't let tests depend on each > other. > The second rule of unit testing is, don't let tests depend on each > other." > ;-) i know this creed, but it seems not to apply where databases are concerned... > You could write them in one big method. But if it is at all possible, try to > create some kind of mock-object that fakes the behaviour of the environment. > (Even if this involves changing the design of the application or the > environment it is probably worth it). IMHO. in brian's (and some of my) situation the database *is* the mock object carying the state - i hardly see the difference between calling a(), b(), c() myself from within test_foo() vs simply making a() -> test_a() b() -> test_b() c() -> test_c() isn't this just semantics? i mean, where do you draw the line, should assertions also be order independent? i guess it seems that tests of systems which carry state cannot avoid order dependancies - it's simply a question of where you enforce it. a while back one of the Test::Unit developers told me they ran the tests in alphabetical order for exactly this reason - so i took advantage of it. -a > The one-big-test way can work nicely too to find bugs, but it's not really > unit testing, so that's why the unit testing tools won't really fit the > problem. > > /Anders > > > > ===== > __________________________________________________ > Anders Bengtsson ndrsbngtssn@yahoo.se > Stockholm, Sweden > > _____________________________________________________ > G� f�re i k�n och f� din sajt v�rderad p� nolltid med Yahoo! Express > Se mer p�: http://se.docs.yahoo.com/info/express/help/index.html > > -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ara.t.howard@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ====================================