You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Spencer A Marks <sm...@digisolutions.com> on 2001/02/06 00:18:09 UTC
JUnit example request
Hi,
I was hoping someone could send or post build.xml snippets that use the
JUnit task def? I'd like to see some real world examples.
Thanks.
Spencer
Re: JUnit example request
Posted by Mikael Eriksson <mi...@bea.com>.
I think that you also need to have junit.jar in your classpath when
running ant.
Mikael
Royston McNeill wrote:
> Do you have a copy of optional.jar in your \ant\lib directory?
>
> -----Original Message-----
> From: Spencer A Marks [mailto:smarks@digisolutions.com]
> Sent: Monday, February 05, 2001 6:47 PM
> To: ant-user@jakarta.apache.org; royston@pressroom.com
> Subject: Re: JUnit example request
>
> Sorry to be punishing your quick reply with another question, but
> could you explain what this means to me:
>
> build.xml:221: Could not create task of type: junit because I can't find it
> in the list of task class definitions. Common solutions are: 1 execute
> bin/bootstrap. 2 use taskdef to declare your task. 3 add the task to
> defaults.properties.
RE: JUnit example request
Posted by Royston McNeill <ro...@pressroom.com>.
Do you have a copy of optional.jar in your \ant\lib directory?
-----Original Message-----
From: Spencer A Marks [mailto:smarks@digisolutions.com]
Sent: Monday, February 05, 2001 6:47 PM
To: ant-user@jakarta.apache.org; royston@pressroom.com
Subject: Re: JUnit example request
Sorry to be punishing your quick reply with another question, but
could you explain what this means to me:
build.xml:221: Could not create task of type: junit because I can't find it
in the list of task class definitions. Common solutions are: 1 execute
bin/bootstrap. 2 use taskdef to declare your task. 3 add the task to
defaults.properties.
Thanks, Spencer
"Royston McNeill" <ro...@pressroom.com> writes:
> Here's an example of a JUnit compilation/test phase build.xml. I use the
> "junit" optional taks include in the optional.jar provide by Jakarta. The
> results from the build produce an XML file that I feed to an HTML file for
> other developers. Enjoy!
Re: JUnit example request
Posted by Spencer A Marks <sm...@digisolutions.com>.
Sorry to be punishing your quick reply with another question, but
could you explain what this means to me:
build.xml:221: Could not create task of type: junit because I can't find it in the list of task class definitions. Common solutions are: 1 execute bin/bootstrap. 2 use taskdef to declare your task. 3 add the task to defaults.properties.
Thanks, Spencer
"Royston McNeill" <ro...@pressroom.com> writes:
> Here's an example of a JUnit compilation/test phase build.xml. I use the
> "junit" optional taks include in the optional.jar provide by Jakarta. The
> results from the build produce an XML file that I feed to an HTML file for
> other developers. Enjoy!
fileset definition help...
Posted by james terry <ja...@unikala.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
how can i use ant to remove a subset of files from a directory where
the definition of that subset is the contents of a different
directory?
from the shell, it would be something like:
cd dir1
for i in `find . -print` ; do
rm dir2/$i
done
thanks,
james@i-mech.com
-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.5.8
iQA/AwUBOoHxkJflVHdG6xJOEQJ9owCeMxvdcoQEfH3YdX7fyU4uat2uuVwAn0Dp
9CbgVvC6fHR7s2UVTwBihnpK
=+6Qc
-----END PGP SIGNATURE-----
RE: JUnit example request
Posted by Royston McNeill <ro...@pressroom.com>.
Here's an example of a JUnit compilation/test phase build.xml. I use the
"junit" optional taks include in the optional.jar provide by Jakarta. The
results from the build produce an XML file that I feed to an HTML file for
other developers. Enjoy!
........................
<project name = "Proj1:FileSystem" default="dist" basedir=".">
<!-- set global properties for this build -->
<property name = "src.dir" value="src" />
<property name="build.dir" value="build/classes" />
<property name="dist" value="dist" />
<property name="doc.dir" value="api" />
<property name="test.dir" value="tests" />
<target name="prepare">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build.dir}" />
<!-- Create javadoc directory -->
<mkdir dir="${doc.dir}" />
<!-- Create junit test directory -->
<mkdir dir="${test.dir}" />
</target>
<target name="JUNIT">
<available property="junit.properties"
classname="junit.framework.TestCase" />
</target>
<target name="compile" depends="JUNIT">
<mkdir dir="${build.dir}" />
<javac srcdir="${src.dir}" destdir="${build.dir}" >
<!-- include all java files -->
<include name="**/*.java" />
<!-- exlude files in the 'javacard' directory -->
<exclude name="**/javacard/*.java" />
</javac>
</target>
<target name="clean">
<!-- Delete the ${build.dir} directory -->
<delete dir="${build.dir}" />
<delete dir="build/testcases" />
</target>
<target name="doc">
<javadoc sourcepath="${build.dir}"
destdir="${doc.dir}"
sourcefiles="*.java" >
</javadoc>
</target>
<target name="compiletests" depends="compile">
<mkdir dir="build/testcases" />
<javac srcdir="${test.dir}" destdir="build/testcases" >
<include name="**/*.java" />
<!-- include the build.dir so we can run the tests -->
<classpath>
<pathelement path="${build.dir}" />
</classpath>
</javac>
</target>
<target name="runtest">
<junit printsummary="yes" fork="no" haltonfailure="no">
<formatter type="xml" />
<classpath>
<!-- INCLUDE BUILD DIR PATH FOR TEST RUN -->
<pathelement location="${test.dir}" />
<pathelement path="${java.class.path}" />
<pathelement path="build/testcases" />
<pathelement path="${build.dir}" />
</classpath>
<test name="FileSystemTest" outfile="${test.dir}/TEST" />
</junit>
</target>
</project>
-----Original Message-----
From: Spencer A Marks [mailto:smarks@digisolutions.com]
Sent: Monday, February 05, 2001 6:18 PM
To: ant-user@jakarta.apache.org
Subject: JUnit example request
Hi,
I was hoping someone could send or post build.xml snippets that use the
JUnit task def? I'd like to see some real world examples.
Thanks.
Spencer