You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Coup, Douglas (MED US)" <do...@siemens.com> on 2006/03/02 15:17:29 UTC

Invoking JUnit tests from Ant


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.
:)

-----------------------------------------
Douglas Coup
Software Engineer, Senior Staff
Soarian Target Architecture
Siemens Medical Solutions Health Services
51 Valley Stream Parkway, W12
Malvern, PA  19355  USA
Phone:  (+01) 610-219-1894
Fax:    (+01) 610-219-9222
Email:  douglas.coup@siemens.com

-------------------------------------------------------------------------------
This message and any included attachments are from Siemens Medical Solutions
USA, Inc. and are intended only for the addressee(s). 
The information contained herein may include trade secrets or privileged or
otherwise confidential information.  Unauthorized review, forwarding, printing,
copying, distributing, or using such information is strictly prohibited and may
be unlawful.  If you received this message in error, or have reason to believe
you are not authorized to receive it, please promptly delete this message and
notify the sender by e-mail with a copy to Central.SecurityOffice@shs.siemens.com

Thank you

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


Re: Invoking JUnit tests from Ant

Posted by Steve Loughran <st...@apache.org>.
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

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

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