From: James Coglan Date: 2009-07-16T02:33:27+09:00 Subject: Re: Test::Unit run order --001636c923d7ae0653046ec1d7d8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 2009/7/15 Dylan > Hey there! I had a question about the order tests are run in > Test::Unit. I have a class with about 10 tests and I'd like to be able > to better control the order they run in. Right now they just run > alphabetically, and I could just add prefixes to my test names, but > I'm likely not going to be the one updating this code in the future > and I'd like to keep it as straightforward and simple as possible > (i.e. not end up with test_admintests_part1_login as a test name). I'm > keeping them all in one class because I'm using CI_reporter to > generate the XML results and I'd like it to be in one file. Is there > any way to change the order individual tests run, or is there a way to > have CI_reporter create only 1 XML file for multiple test suites. I've > looked around quite a bit for answers to either of these questions but > have so far found nothing (although it's a distinct possibility that I > just totally missed it an need a smack on the head). :) Thank you very > much! I can't speak about your XML stuff, but I'm pretty sure the Test::Unit::TestCase.suite method sorts the tests by name so you can't change the order. Your options are: 1) Construct the test suite yourself rather than relying on the above method to do it for you. You'll have to dig around in Test::Unit's source to figure out how to run tests without using AutoRunner. 2) Take a look at some of the code in test/unit/ui and look at the logging events that tests fire. These should allow you to collect event data and reorder it however you like before creating a report. Both will require some inspecting of Test::Unit's source, but I'm sure others have better suggestions. Test::Unit's README is pretty good if you need to know some details on its internals, e.g. how TestCases are converted to suites and run. --001636c923d7ae0653046ec1d7d8--