On Fri, Aug 30, 2002 at 08:32:08PM +0100, Ed Avis wrote: > Isn't it bad style to require a particular order for the tests?
Does the word "test" here refer to a single "ok($foo)" or to an entire testing file? We're talking about test files which already contain lots and lots of tests. Either way, the answer is no. Individual tests must be run in order because test files are merely programs. Programs require an order of execution. If you want to isolate each test as an independent unit you'd have to write/run setup/teardown code for each test. I've rarely found it to be worth the trouble. XUnit makes that sort of thing easier you're interested. Test files can require an order for two reasons. First, you often want to run the most basic tests first. You'll notice Test::Harness has t/00compile.t which runs first and makes sure everything compiles. On failure it could use the "BAILOUT" feature to cause further testing to halt. MakeMaker has t/00setup_dummy.t and t/zz_cleanup_dummy.t to setup and remove a dummy module which it uses for testing through out. I could have also setup and tore down the module inside each test, in fact I probably should it would make things easier. -- Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One The beatings will continue until your style improves.
