I can run my tests via Ant in IDE.
But, While i try to run it from Command Line - it fails, because cant find the Excel from Resources
I added:
`<copy todir="test/Resources/Data">
<fileset dir="${Resources}/Data">
<exclude name="**/*.java"/>
</fileset>
</copy>`
the file copied but still fail.
Looks like code doesnt look in correct place..
Any idea?
full build.xml:
<project name="TestNGTest" default="test" basedir=".">
<!-- Define <testng> task -->
<taskdef name="testng" classname="org.testng.TestNGAntTask">
<classpath>
<pathelement location="lib/testng-6.8.5.jar"/>
</classpath>
</taskdef>
<property name="testdir" location="test" />
<property name="srcdir" location="src" />
<property name="libdir" location="lib" />
<property name="full-compile" value="true" />
<property name="Resources" location="Resources"/>
<copy todir="test/Resources/Data">
<fileset dir="${Resources}/Data">
<exclude name="**/*.java"/>
</fileset>
</copy>
<path id="classpath.base"/>
<path id="classpath.test">
<fileset dir="${libdir}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${testdir}" />
<pathelement location="${srcdir}" />
<path refid="classpath.base" />
</path>
<target name="clean" >
<delete verbose="${full-compile}">
<fileset dir="${testdir}" includes="**/*.class" />
</delete>
</target>
<target name="compile" depends="clean">
<javac srcdir="${srcdir}" destdir="${testdir}"
verbose="${full-compile}">
<classpath refid="classpath.test"/>
</javac>
</target>
<target name="test" depends="compile">
<testng outputdir=".test-output" classpathref="classpath.test"
useDefaultListeners="false"
listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter">
<xmlfileset dir="." includes="testng.xml"/>
</testng>
</target>
</project>'
i found the problem.
in code i use the System.getProperty("user.dir") and when running from ant it finds my "user" folder.
So i can manually put there the excel ant it works.
Now, i need to find the way to change the System.getProperty("user.dir") to something that points to projects root
Related
I am trying to set up unit testing with Travis-CI for my java project, and I am having some difficulties. The issue is that I would like it to run all of the unit tests I have in the src/test/ file without having to specify the test name directly. This is because I will keep adding tests, and I would not like to constantly export the build.xml file. The xml I currently have is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="COSC 4F90">
<property environment="env"/>
<property name="junit.output.dir" value="junit"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.8"/>
<property name="source" value="1.8"/>
<path id="COSC 4F90.classpath">
<pathelement location="bin"/>
<pathelement location="lib/commons-math3-3.6.1.jar"/>
<pathelement location="lib/junit.jar"/>
<pathelement location="lib/org.hamcrest.core_1.3.0.v201303031735.jar"/>
</path>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="bin"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-project" name="build"/>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="COSC 4F90.classpath"/>
</javac>
</target>
<target name="test" depends="build"><!--depends="build"-->
<junit printsummary="withOutAndErr" haltonfailure="yes">
<classpath>
<path refid="COSC 4F90.classpath" />
<!--pathelement location="${test.build.dir}"/-->
</classpath>
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="COSC 4F90.classpath" includes="**/*Test*.java" />
</batchtest>
</junit>
</target>
</project>
The error that I receive with Travis-CI is
Cannot find symbol
[javac] import simulation.creature.NeuralNet;
[javac] ^
If anyone could help me out it would be much appreciated.
Thanks!
I opened an existing project using the ant buildfile. I got a lot of error about import x cannot be resolved. I don't have the src files for those in my project folder, but I have their compiled jar files. So I went to java build path -> libraries and used the add external JARs to add them to my project and all the error in my project went away.
However, now when I build the project by running the ant file, i get
[javac] Compiling 149 source files to X:\swt\documation\build
[javac] X:\swt\documation\src\swt\documation\bookshelf\objectmodel\Trans.java:20: package utilities does not exist
[javac] import utilities.StringUtils;
So the same files that gave me error but I though I fixed is giving me error again. What am I doing wrong? I added the jar file to the java build path library so why can't eclipse find these packages?
This is the build.xml file.
<?xml version="1.0"?>
<project name="documation" basedir="." default="packageApplication">
<condition property="vob.prefix" value="/cm_data" else="X:">
<os family="unix" />
</condition>
<property name="jar.keystore" value="${vob.prefix}/swt/cots/signJarKey"/>
<property name="oracle.cots.dir" value="${vob.prefix}/swt/cots/oracle/oracle/9.2.0"/>
<property name="utilities.dir" value="${vob.prefix}/swt/utilities/lib"/>
<property name="swt.mailer.dir" value="${vob.prefix}/swt/mailer/lib"/>
<property name="swt.logger.dir" value="${vob.prefix}/swt/logger/lib"/>
<property name="userprofile.dir" value="${vob.prefix}/swt/ups/lib"/>
<property name="apache.dir" value="${vob.prefix}/swt/cots/apache/apache/1.3.12"/>
<property name="jakarta.dir" value="${vob.prefix}/swt/cots/apache/jakarta"/>
<property name="frameworks.dir" value="${vob.prefix}/swt/cots/frameworks"/>
<property name="spring.dir" value="${frameworks.dir}/spring"/>
<property name="zk.dir" value="${frameworks.dir}/zk"/>
<property name="junit.dir" value="${vob.prefix}/swt/cots/junit"/>
<property name="vob.dir" value="."/>
<property name="webapp.name" value="documation"/>
<property name="src.dir" value="${vob.dir}/src"/>
<property name="bin.dir" value="${vob.dir}/bin"/>
<!-- This directory must be created view-private -->
<property name="build.dir" value="${vob.dir}/build"/>
<property name="web.dir" value="${vob.dir}/webapps"/>
<property name="dist.web.dir" value="${build.dir}/webapps"/>
<property name="lib.dir" value="${web.dir}/WEB-INF/lib"/>
<property name="tomcat.home" value="${vob.prefix}/swt/cots/apache/tomcat/6.0.28"/>
<property name="dist.dir" value="${vob.dir}/dist"/>
<property name="tmp.dir" value="${vob.dir}/temp"/>
<property name="report.dir" value="${vob.dir}/webapps/reports"/>
<path id="classpath">
<fileset dir="${junit.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${jakarta.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${apache.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${swt.logger.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${oracle.cots.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${utilities.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${swt.mailer.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${userprofile.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${tomcat.home}">
<include name="servlet*.jar"/>
</fileset>
<fileset dir="${frameworks.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${spring.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${zk.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${build.dir}"/>
</path>
<target name="packageApplication" description="tar all application files"
depends="signJars" >
<tar destfile="${dist.dir}/documation.tar"
basedir="${tmp.dir}/webapp"
includes="**"
/>
</target>
<target name="signJars" depends="appletJar">
<signjar jar="${tmp.dir}/${webapp.name}-applet.jar"
alias="dmsKey"
keystore="${jar.keystore}"
storepass="dmsKey"
signedjar="${tmp.dir}/webapp/jsp/${webapp.name}-signed-applet.jar"
/>
<signjar jar="${vob.prefix}/swt/logger/lib/logger.jar"
alias="dmsKey"
keystore="${jar.keystore}"
storepass="dmsKey"
signedjar="${tmp.dir}/webapp/jsp/logger-signed.jar"
/>
<signjar jar="${vob.prefix}/swt/cots/apache/jakarta/commons-httpclient-3.0.1.jar"
alias="dmsKey"
keystore="${jar.keystore}"
storepass="dmsKey"
signedjar="${tmp.dir}/webapp/jsp/httpclient-signed.jar"
/>
<signjar jar="${vob.prefix}/swt/cots/apache/jakarta/commons-logging-api.jar"
alias="dmsKey"
keystore="${jar.keystore}"
storepass="dmsKey"
signedjar="${tmp.dir}/webapp/jsp/commonlogging-signed.jar"
/>
<signjar jar="${vob.prefix}/swt/cots/apache/jakarta/commons-codec-1.3.jar"
alias="dmsKey"
keystore="${jar.keystore}"
storepass="dmsKey"
signedjar="${tmp.dir}/webapp/jsp/commoncodec-signed.jar"
/>
</target>
<target name="appletJar" depends="documationJar">
<jar destfile="${tmp.dir}/${webapp.name}-applet.jar"
basedir="${build.dir}"
includes="swt/documation/dms/webdocs/client/*.class"
/>
</target>
<target name="documationJar" depends="zkStyleJar">
<jar destfile="${tmp.dir}/webapp/WEB-INF/lib/${webapp.name}.jar"
basedir="${build.dir}"
includes="swt/documation/bookshelf/**, swt/documation/dms/** swt/documation/objectmodel/** swt/documation/servlets/**"
excludes="swt/documation/dms/webdocs/client/*.class"
/>
</target>
<target name="zkStyleJar" depends="documationNGJar">
<jar destfile="${tmp.dir}/webapp/WEB-INF/lib/${webapp.name}-ZkStyle.jar"
basedir="${web.dir}/zkStyle"
includes="**"
/>
</target>
<target name="documationNGJar" depends="compileBuildDir">
<jar destfile="${tmp.dir}/webapp/WEB-INF/lib/${webapp.name}NG.jar"
basedir="${build.dir}"
includes="swt/documation/ng/** swt/documation/service/** swt/documation/web/**" />
</target>
<target name="compileBuildDir" description="Compile main source tree java files" depends="copyToTmp">
<javac destdir="${build.dir}" target="1.5" debug="true"
deprecation="false" optimize="true" failonerror="true">
<src path="${src.dir}"/>
<exclude name="test/swt/documation/service/**/*.java"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="copyToTmp" depends="cleanTmpDir">
<copy todir="${tmp.dir}/webapp">
<fileset dir="${web.dir}">
<exclude name="**/classes/**"/>
<exclude name="**/lib/*.jar"/>
<exclude name="**/zkStyle/**"/>
</fileset>
</copy>
</target>
<target name="cleanTmpDir">
<delete>
<fileset dir="${build.dir}" />
</delete>
<delete>
<fileset dir="${dist.dir}" />
</delete>
<delete>
<fileset dir="${tmp.dir}" />
</delete>
<mkdir dir="${tmp.dir}/webapp"/>
<mkdir dir="${tmp.dir}/webapp/lib"/>
</target>
<target name="reports" description="Compiles all the XML report designs and produces the .jasper files.">
<taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask">
<classpath refid="classpath"/>
</taskdef>
<jrc destdir="${report.dir}">
<src>
<fileset dir="${report.dir}">
<include name="**/*.jrxml"/>
</fileset>
</src>
<classpath refid="classpath"/>
</jrc>
</target>
</project>
Adding libraries to eclipse build path is different from Ant build path, for eclipse to compile your project what you did is correct.
But for your ant build to work, you need to place the libraries in location defined in your Ant build xml.
I think by looking at your Ant build xml, you should place your libraries for fixing import utilities.StringUtils problem in ${vob.prefix}/swt/utilities/lib check the line
<property name="utilities.dir" value="${vob.prefix}/swt/utilities/lib"/>
I think I figured the problem. In my build.xml file,
<fileset dir="${utilities.dir}">
<include name="*.jar"/>
</fileset>
it is compiling those src files into jar files and using those jar files in those folder to compile my main program. Even though I added the jar files to my java build path libraries, eclipse is still looking for those jar files in those folders. So if i just put my jar files in those folder then my program works (why those src files didnt get automatically compiled into jar files is another problem, but at least my program compile now).
I need to use ant to test my project develop in Java. I cannot make ant works properly. I haven't trully understood how to set the path for ant which files are needed to test correctly the project.
Which type of file is expecting? source or binary?
I am using this ant file to run the test :
<project name="acmetelecom" default="compile">
<property name="src" location="src/acme/com/acmetelecom" />
<property name="src" location="src/acme/com/acmetelecom" />
<property name="fit" location="fit" />
<property name="bin" location="bin" />
<property name="lib" location="lib" />
<property name="report" location="report" />
<property name="junit.report" location="report/junit" />
<property name="fit.report" location="report/fit" />
<path id="lib.classpath">
<fileset dir="${lib}">
<include name="**/*.jar" />
<include name="*" />
</fileset>
</path>
<path id="test.classpath">
<path refid="lib.classpath" />
<pathelement location="lib/junit/junit-4.4.jar" />
<pathelement location="lib/junit/junit-4.4-src.jar" />
<pathelement location="${bin}" />
</path>
<target name="compile">
<mkdir dir="${bin}" />
<javac srcdir="${src}" destdir="${bin}">
<classpath refid="lib.classpath" />
</javac>
</target>
<target name="junit" depends="compile">
<mkdir dir="${junit.report}" />
<junit printsummary="yes" fork="yes" haltonfailure="no">
<classpath refid="test.classpath" />
<formatter type="plain" />
<batchtest fork="yes" todir="${junit.report}">
<fileset dir="bin/com/acmetelecom">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
<target name="fit" depends="compile">
<mkdir dir="${fit.report}" />
<java classname="fitlibrary.runner.FolderRunner" fork="yes"
failonerror="yes">
<classpath refid="test.classpath" />
<arg value="${fit}" />
<arg value="${fit.report}" />
</java>
<echo>Please see the FIT report page for more details</echo>
</target>
<target name="clean">
<delete dir="${bin}" />
<delete dir="${report}" />
</target>
</project>
I cannot see what I am doing wrong! The tests are in the same directory as the source code.
The root node of an Ant script is the project tag. An example I suggest starting simple... like get your Java source to compile, then add junit, etc.
You are writing .class files to ${bin}. Try to give that as argument in batchtest's fileset. There is no need to give packagedirectory paths anyway. */.class is going to check all directories.
<batchtest fork="yes" todir="${junit.report}">
<fileset dir="${bin}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
I'm developing an Eclipse SWT application using Eclipse. There are also some JUnit 4 tests, which test some DAO's. But when I try to run the tests via an ant build, all of the tests fail, because the test classes aren't found.
Google brought up about a million of people who all have the same problem, but none of their solutions seem to work for me -.- .
These are the contents of my build.xml file:
<property name="test.reports" value="./test/reports" />
<property name="classes" value="build" />
<path id="project.classpath">
<pathelement location="${classes}" />
</path>
<target name="testreport">
<mkdir dir="${test.reports}" />
<junit fork="yes" printsummary="no" haltonfailure="no">
<batchtest fork="yes" todir="${test.reports}" >
<fileset dir="${classes}">
<include name="**/Test*.class" />
</fileset>
</batchtest>
<formatter type="xml" />
<classpath refid="project.classpath" />
</junit>
<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${test.reports}" />
</junitreport>
</target>
The test classes are in the build-directory together with the application classes, although they are in some subfolders according to their packages.
Maybe this is important too: At first Ant complained that JUnit wasn't in its classpath, but since I put it there (with the eclipse configuration editor) it complains about JUnit being in its classpath twice.
WARNING: multiple versions of ant detected in path for junit
[junit] jar:file:C:/Users/as df/Documents/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib/ant.jar!/org/apache/tools/ant/Project.class
[junit] and jar:file:/C:/Users/as%20df/Documents/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib/ant.jar!/org/apache/tools/ant/Project.class
I've tried specifying each and every subdirectory, each and every class file, I've tried filesets and filelists, nothing seems to work.
Thanks for your help, I've been sitting for hours on this thing now...
I was getting this only when using the 'fork=true' option to the junit task. It was happening because my ANT_HOME had '..' in it (e.g. '/3rdparth/jboss/jboss-5/../tools'). Once I reduced that path, the 'multiple versions of ant' warning went away.
I had the same problem 'multiple versions of ant detected in path for junit'. The problem went away when I renamed by Eclipse_Home directory and removed special characters from it. The path had '[1]' in it which was causing the problem.
This Ant build.xml works fine for me. Check out the properties to see if the directory structure matches yours; adjust as needed.
<?xml version="1.0" encoding="UTF-8"?>
<project name="xslt-converter" basedir="." default="package">
<property name="version" value="1.6"/>
<property name="haltonfailure" value="no"/>
<property name="out" value="out"/>
<property name="production.src" value="src"/>
<property name="production.lib" value="lib"/>
<property name="production.resources" value="config"/>
<property name="production.classes" value="${out}/production/${ant.project.name}"/>
<property name="test.src" value="test"/>
<property name="test.lib" value="lib"/>
<property name="test.resources" value="config"/>
<property name="test.classes" value="${out}/test/${ant.project.name}"/>
<property name="exploded" value="out/exploded/${ant.project.name}"/>
<property name="exploded.classes" value="${exploded}/WEB-INF/classes"/>
<property name="exploded.lib" value="${exploded}/WEB-INF/lib"/>
<property name="reports.out" value="${out}/reports"/>
<property name="junit.out" value="${reports.out}/junit"/>
<property name="testng.out" value="${reports.out}/testng"/>
<path id="production.class.path">
<pathelement location="${production.classes}"/>
<pathelement location="${production.resources}"/>
<fileset dir="${production.lib}">
<include name="**/*.jar"/>
<exclude name="**/junit*.jar"/>
<exclude name="**/*test*.jar"/>
</fileset>
</path>
<path id="test.class.path">
<path refid="production.class.path"/>
<pathelement location="${test.classes}"/>
<pathelement location="${test.resources}"/>
<fileset dir="${test.lib}">
<include name="**/junit*.jar"/>
<include name="**/*test*.jar"/>
</fileset>
</path>
<path id="testng.class.path">
<fileset dir="${test.lib}">
<include name="**/testng*.jar"/>
</fileset>
</path>
<available file="${out}" property="outputExists"/>
<target name="clean" description="remove all generated artifacts" if="outputExists">
<delete dir="${out}" includeEmptyDirs="true"/>
<delete dir="${reports.out}" includeEmptyDirs="true"/>
</target>
<target name="create" description="create the output directories" unless="outputExists">
<mkdir dir="${production.classes}"/>
<mkdir dir="${test.classes}"/>
<mkdir dir="${reports.out}"/>
<mkdir dir="${junit.out}"/>
<mkdir dir="${testng.out}"/>
<mkdir dir="${exploded.classes}"/>
<mkdir dir="${exploded.lib}"/>
</target>
<target name="compile" description="compile all .java source files" depends="create">
<!-- Debug output
<property name="production.class.path" refid="production.class.path"/>
<echo message="${production.class.path}"/>
-->
<javac srcdir="src" destdir="${out}/production/${ant.project.name}" debug="on" source="${version}">
<classpath refid="production.class.path"/>
<include name="**/*.java"/>
<exclude name="**/*Test.java"/>
</javac>
<javac srcdir="${test.src}" destdir="${out}/test/${ant.project.name}" debug="on" source="${version}">
<classpath refid="test.class.path"/>
<include name="**/*Test.java"/>
</javac>
</target>
<target name="junit-test" description="run all junit tests" depends="compile">
<!-- Debug output
<property name="test.class.path" refid="test.class.path"/>
<echo message="${test.class.path}"/>
-->
<junit printsummary="yes" haltonfailure="${haltonfailure}">
<classpath refid="test.class.path"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${junit.out}">
<fileset dir="${test.src}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${junit.out}">
<fileset dir="${junit.out}">
<include name="TEST-*.xml"/>
</fileset>
<report todir="${junit.out}" format="frames"/>
</junitreport>
</target>
<taskdef resource="testngtasks" classpathref="testng.class.path"/>
<target name="testng-test" description="run all testng tests" depends="compile">
<!-- Debug output
<property name="test.class.path" refid="test.class.path"/>
<echo message="${test.class.path}"/>
-->
<testng classpathref="test.class.path" outputDir="${testng.out}" haltOnFailure="${haltonfailure}" verbose="2" parallel="methods" threadcount="50">
<classfileset dir="${out}/test/${ant.project.name}" includes="**/*.class"/>
</testng>
</target>
<target name="exploded" description="create exploded deployment" depends="testng-test">
<copy todir="${exploded.classes}">
<fileset dir="${production.classes}"/>
</copy>
<copy todir="${exploded.lib}">
<fileset dir="${production.lib}"/>
</copy>
</target>
<target name="package" description="create package file" depends="exploded">
<jar destfile="${out}/${ant.project.name}.jar" basedir="${production.classes}" includes="**/*.class"/>
</target>
</project>
Hey guys I've been trying all day to get an ant file to automatically build my project. The file (appended below) was on a web page I found and is pretty thorough.
My problem is that it works as long as I don't run the "clean" target. Once the I run the "clean" target the "test" target ceases to work. I get NoClassFound errors on all test classes. Even though it worked earlier.
I'm working on a Macbook (10.5.8) using the latest version of eclipse. This error occurs running the file from eclipse and from a terminal using Ant version 1.7.1
I modified the file slightly to adapt it to my file structure which is as follows:
src/
packageA.packageB/
ClassA.java
...
ClassN.java
unittests/
packageA.packageB/
AllClassTests.java
ClassATest.java
...
ClassNTest.java
lib/
junit-4.7.jar
The ant file is:
<project name="SampleJUnitTests" default="dist" basedir=".">
<description>
DataTypes Build File
</description>
<!-- set global properties for this build -->
<property name="project_name" value="DataTypes"/>
<property name="src" location="src"/>
<property name="build" location="bin"/>
<property name="dist" location="dist"/>
<property name="lib" location="lib"/>
<property name="reports" location="reports"/>
<property name="tests" location="unittests"/>
<property name="tmp" location="tmp_file"/>
<!-- the names of various distributable files -->
<property name="jar_name" value="${project_name}.jar"/>
<property name="war_name" value="${project_name}.war"/>
<!-- top level targets -->
<target name="compile" depends="init" description="compile the source code " >
<javac srcdir="${src}" destdir="${build}">
<classpath>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<target name="dist" depends="compile" description="generate the distributable files " >
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/${jar_name}" basedir="${build}"/>
</target>
<target name="clean" description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${reports}"/>
<delete dir="${tmp}"/>
</target>
<target name="run-tests" depends="compile" description="run your test suite" >
<junit printsummary="yes" haltonfailure="no" showoutput="yes" tempdir="${tmp}">
<classpath>
<pathelement path="${build}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
<batchtest fork="yes" todir="${reports}/raw/">
<formatter type="xml"/>
<fileset dir="${tests}">
<include name="**/*.java"/>
<exclude name="**/All*Tests.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name ="test" depends="run-tests">
<junitreport todir="${reports}">
<fileset dir="${reports}/raw/">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${reports}\html\"/>
</junitreport>
</target>
<target name ="run" depends="" description="if this project can be run, run it" >
</target>
<!-- supporting targets -->
<target name="init" description="initialize the build environment" >
<!-- Create the time stamp -->
<tstamp/>
<!-- Create directory structures -->
<mkdir dir="${build}"/>
<mkdir dir="${lib}"/>
<mkdir dir="${dist}/lib"/>
<mkdir dir="${reports}"/>
<mkdir dir="${reports}/raw/"/>
<mkdir dir="${reports}/html/"/>
<mkdir dir="${tmp}"/>
</target>
<target name="all" depends="clean, test">
</target>
I give up and hope that someone can shine a light on my problem.
Thanks a lot!
You haven't got any Ant target which builds the test classes. You could do this as part of the compile target if you wanted:
<target name="compile" depends="init" description="compile the source code " >
<javac srcdir="${src}" destdir="${build}">
<classpath>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
<javac srcdir="${tests}" destdir="${build}">
<classpath>
<pathelement path="${build}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
</target>