From: Brian Candler Date: 2003-05-16T01:51:02+09:00 Subject: Re: Test::Unit sequencing On Fri, May 16, 2003 at 12:34:48AM +0900, ahoward wrote: > 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. I think I can see where Anders is coming from: I could replace my database (the bit which carries state) with a mock DBI server, and check that the main code requests the correct sequence of SQL statements (i.e. assert on the work which the black box is doing, not just on the results coming out of it). But this is a lot of work - as well as checking that the correct requests hit the mock object, I have to supply all the correct responses. Actually, I *am* doing some state checks (i.e. after doing an operation which should insert something into the database, I do a direct SQL select from it and check what I expect to be there is), so perhaps my methodology isn't completely consistent; but this lets me be selective about the things that I check, picking a few pertinent rows and fields here and there to check to get sufficient coverage, with minimal work. You can say this is not pure unit testing, but from a pragmatic point of view it seems to be getting the work done nicely right now :-) Cheers, Brian.