As a non-Ant approach to this problem, have you considered OrderedTestSuite provided in the "JUnit addons" package (see <http://sourceforge.net/projects/junit-addons>)?
Kendall ----- Original Message ----- From: "Tom Lipkis" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, October 14, 2002 16:05 Subject: Re: Sorting filesets > > > I'm trying to find a way to run JUnit test classes in a > > > particular order, which is determined by some property of > > > each class. I was easily able to pick a subset of test > > > > Typically, you don't want to do this. Tests should be > > independent of each other. JUnit does not guarantee the > > order it will run tests within a Test class, and I don't > > think Ant guarantees the order it will run tests. > > > > If you need to run a set of tests in a specific order, you > > can construct a test suite by hand in a Java file. If you > > want to be able to run a single test, you can use the > > technique in Hatcher and Loughran's book on page 103. > > > > If you're writing tests that depend on ordering, don't. > > The Test classes are independent of each other, and I am not concerned > about the order in which the tests within a single Test class are run. > However, take the case where class A depends on functionality in class B. > Having just performed a large transformation across the entire system and > broken both low-level and high-level functionality, I need to run all the > tests, but there is little point in running TestA until TestB succeeds. > > My current choices are to run individual tests, manually sorting them into > a useful order, or to run all tests, with haltonfailure=no, and manually > search for failures in lowest-level classes first. I'd like to automate > this by listing the "prerequisites" in a static var in each Test class, and > sorting based on that. It seemed like there would be a simple way to do > that in Ant, but I don't see it. > > Tom -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
