ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject Re: Invoking JUnit tests from Ant
Date Thu, 02 Mar 2006 16:03:35 GMT
Coup, Douglas (MED US) wrote:
> I'm working with an Ant script that builds a collection of Java plug-ins
> and then tries to run some Junit tests against them.
> The running of the Junit tests is attempted using the <java> task (<java
> classname="org.eclipse.core.launcher.Main"....>).  The -application
> parameter is set to "org.eclipse.test.coretestapplication".
> When the script gets to this task, I get a
> java.lang.NoClassDefFoundError: junit/framework/TestListener error.  The
> plugins folder in the target area that the script is using has the
> org.junit_3.8.1 plug-in there.  The ANT_HOME environment variable points
> to a folder that contains a lib folder with junit-3.8.1.jar in it.  I've
> also tried numerous things to get the plug-in's junit.jar into a
> location where I thought it would be seen, but with no success.
> Does anyone know how to accomplish what I'm trying to do?  I'm fairly
> new to Ant, so don't hesitate to include some detail in your response.
> :)

I'd use the <junit> task; I dont know what the eclipse testrunner does, 
but it is not ant-aware.

we have just been tweaking it to improve library set up for <junit>, but 
for ant 1.6

-you need junit.jar and ant-junit.jar in ANT_HOME/lib

-If you still get classpath problems, force ant's classpath down into 
the task with something like

         <pathelement path="${java.class.path}" />
         <pathelement location="${target.jar}" />

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

View raw message