ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <skitch...@apache.org>
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 <skitching@apache.org> 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
> > org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner 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:
http://marc.theaimsgroup.com/?l=jakarta-commons-dev&m=112004597501874&w=2
and an example test case here:
http://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message