ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: Executing junit tests with differing classpaths
Date Wed, 06 Jul 2005 03:10:59 GMT
On Sun, 2005-06-26 at 12:07 +0200, Stefan Bodewig wrote:
> On Sun, 26 Jun 2005, Simon Kitching <> wrote:
> > Am I right in thinking that the <junit> task provides no way for the
> > classloader setup in the forked JVM to be tweaked before the test is
> > executed?
> Not sure.  You can pass a <classpath> to the forked VM.  You could
> turn your current classloader-logic into an Ant task that creates a
> Path reference, something like
> <create-classpath forTest="testclass" useId="first-batch"/>
> <junit classpathref="first-batch" ....>
> > If so, would anyone be interested in extending Ant with a hook to
> > allow this? I *think* it's just a matter of providing the <junit>
> > task with an attribute "testRunnerClass" which defaults to
> > rather
> > than hardwiring that string into the JUnitTask class.
> Something like this is way down on my TODO list, so I'd be glad if
> anybody else picked it up.  In my case it is as a way to provide a
> JUnit 4 Testrunner.
> It's not that simple, though.  Ant's TestRunner is responsible for
> routing events to the formatters, for example.  So we can't take an
> arbitrary test-runner, we do have some additional requirements.

Just for everyone's information, I actually decided to take a different
approach to this. By creating a custom TestSuite class, it is possible
to control the classloader hierarchy used for a TestCase's tests without
making changes to junit or ant.

You can find the details here:
and an example test case here:



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

View raw message