ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J. Xue" <>
Subject Re: run junit tests in a certain order
Date Wed, 26 Nov 2003 14:20:54 GMT
Quoting Stefan Bodewig <>:

> On Tue, 25 Nov 2003, J. Xue <> wrote:
> > I'm sure I'm not the first one having this problem but can't find
> > anything on google.
> Well, then you didn't use the right keywords 8-)

Well, figuring out the right google keywords has been one of the hardest parts 
in my computing experience.  8-)

> Generally, JUnit advocates are going to tell you that you are trying
> to do the wrong thing in the first place as unit tests are supposed to
> be independent of each other.

I totally agree, but then it doesn't contradict to what I'm trying to do.  My 
tests are independent.  I just feel it a bit silly to waste 20 mins to run a 
AdvancedTests suite that's doomed to fail because the SanityCheckTests suite 
would have failed quickly, had it not been because of the OS I'm running on 
happens to decide to return files in alphabetical order.

Oh well, this ain't the junit list...  8-)

> Now to your problem:
> An alternative to your approach is to explicitly use <test> elements
> for the tests that need a certain order and exclude them from the
> <batchtest> that contains the rest.

I do realize I have this option, but then I'd have to hardcode the test order 
in build.xml.  Another disadvantage is that since I always fork the runner VM, 
having a lot of <test>/<batchtest> elements would tend to slow down the build.

> > For a workaround, I wrote a master test suite, in which I read from
> > a file that has the list of test files in the order I want them to
> > run.  I then run it using <test>.  Now everything works fine as far
> > as order enforcement is concerned - but all the test methods are
> > listed under the master test suite class in the report!
> With Ant 1.6beta, all necessary information is inside the XML reports,
> but I don't think that <junitreport> uses it right now (an attribute
> has been added to the test elements).  If you use the beta and modify
> the XSLs to use the new attribute, your reports should work as well.

I'll definitely give it a try tonight.  Thanks.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message