I am getting a ClassNotFound exception when I try to run my unit test.
Here is the .xml script for running the test.
<?xml version="1.0"?>
<project name="Embedded CST316 Project Test Build" default="targets" basedir=".">
<!-- set global properties for this build -->
<property name="src" location="airAutomation/src" />
<!-- <property name="test" location="airAutomation/test" /> -->
<property name="test" location="airAutomation/testAirUI/airUI/pkg" />
<property name="build" location="airAutomation/classes" />
<property name="test.dir" location="airAutomation/classes/tests" />
<property name="test.report.dir" location="airAutomation/testreport" />
<path id="junit.class.path">
<pathelement location="${build}" />
<pathelement location="airAutomation/lib/xbjlib-1.0.1.jar" />
<pathelement location="airAutomation/lib/junit-4.12.jar" />
<pathelement location="airAutomation/lib/hamcrest-core-1.3.jar" />
</path>
<target name="targets">
<!-- Display available targets -->
<echo message="targets are clean, prepare, compile, junit"/>
</target>
<target name="clean">
<!-- Delete the ${build} directory tree -->
<delete dir="${build}" />
<delete dir="${test.report.dir}" />
<!-- <delete dir="${test}" /> -->
</target>
<target name="prepare">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- <mkdir dir="${test}" /> -->
<mkdir dir="${test.dir}" />
<mkdir dir="${test.report.dir}" />
</target>
<target name="compile" depends="clean, prepare"
description="Compile Unit Tests">
<!-- Compile all classes -->
<javac srcdir="${src}"
includeantruntime="false"
destdir="${build}" >
<classpath refid="junit.class.path" />
</javac>
<javac srcdir="${test}"
includeantruntime="false"
destdir="${test.dir}" >
<classpath refid="junit.class.path" />
</javac>
</target>
<target name="junit" depends="compile"
description="Execute Unit Tests">
<!-- Run Junit tests -->
<junit printsummary="yes" fork="true" haltonfailure="yes">
<classpath refid="junit.class.path" />
<classpath>
<pathelement location="${test.dir}" />
</classpath>
<formatter type="xml" />
<batchtest todir="${test.report.dir}">
<fileset dir="airAutomation/testAirUI/airUI/pkg/">
<include name="**Test*.java" />
</fileset>
</batchtest>
</junit>
</target>
</project>
Here is the output from the end of the xml.
<error message="roomTest" type="java.lang.ClassNotFoundException">
java.lang.ClassNotFoundException: roomTest
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
</error>
The test is in the folder "airAutomation/testAirUI/airUI/pkg/"
Would I need to specify this folder somewhere else (I created some folders to hold the output of the tests)?
Related
I have searched for how to get coverage report for Corbetura for Power Mock Test Cases.
Found many answers for that, but still getting many issues.
I am using below configuration in my application:
Java (JDK) : 1.5.0_22
Eclipse : Indigo
Ant : 1.8.2
Corbetura Libraries : Tried with 2.1.1
(Still question which set of libraries to use ?)
Please help me on this.
Note: I am using JDK 1.5, I have found many links where it has mentioned configurations with JDK 1.6.
One more thing:
As of now I am not able to execute Ant script with <cobertura-instrument> tag.
Find below the build XML I am using.
I have removed some portion of build xml (I cannot share that due to confidentiality).
Please suggest what is the correct way, to do the code coverage report of Power Mock Test Cases using Corbetura and JDK 1.5 with Ant.
<project name="projName" basedir="." default="clean">
<description>
Project Desc
</description>
<!-- PROPERTIES -->
<property name="src.dir" location="src" />
<property name="test.dir" location="test" />
<property name="build.dir" location="build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="testclasses.dir" value="${build.dir}/testclasses" />
<property name="instrumentedclasses.dir" value="${build.dir}/instrumentedclasses" />
<property name="dist.dir" location="dist" />
<property name="resources.dir" location="resources" />
<property name="libs.dir" value="lib" />
<property name="testReport.dir" location="testReport" />
<property name="cobertura.reports.dir" location="codecoverage" />
<property name="cobertura.datafile" value="${build.dir}/cobertura.ser" />
<property name="project.name" value="${ant.project.name}" />
<property name="cobertura.dir" value="D:\\corbetura_libs" />
<!-- PATHS -->
<path id="src.compile.classpath" description="classpath for compiling sources">
<fileset dir="${libs.dir}">
<include name="**/*.jar" />
<exclude name="**/junit*.jar" />
</fileset>
</path>
<path id="test.compile.classpath" description="classpath for compiling test-sources">
<pathelement location="${classes.dir}" />
<fileset dir="${libs.dir}">
<include name="**/*.jar" />
<exclude name="**/cobertura-2.1.1.jar" />
<exclude name="cobertura-dependencies/*.jar" />
</fileset>
</path>
<path id="test.runtime.classpath" description="classpath for running junit-tests">
<pathelement location="${testclasses.dir}" />
<pathelement location="${instrumentedclasses.dir}" />
<fileset dir="${libs.dir}">
<include name="**/*.jar" />
<exclude name="**/cobertura-2.1.1.jar" />
<exclude name="cobertura-dependencies/*.jar" />
<exclude name="cobertura-dependencies/hamcrest*.jar" />
</fileset>
</path>
<path id="cobertura.classpath" description="classpath for test-report">
<fileset dir="${cobertura.dir}">
<include name="cobertura*.jar" />
<include name="cobertura-dependencies/*.jar" />
</fileset>
</path>
<!-- taskdefs -->
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<!-- PREPARE -->
<target name="prepare" description="creating the needed directories for build and test report">
<delete dir="${build.dir}" />
<delete dir="${testReport.dir}" />
<delete dir="${cobertura.reports.dir}" />
<mkdir dir="${build.dir}" />
<mkdir dir="${classes.dir}" />
<mkdir dir="${testclasses.dir}" />
<mkdir dir="${cobertura.reports.dir}" />
<mkdir dir="${testReport.dir}" />
</target>
<!-- COMPILE SOURCES -->
<target name="compile.sources" depends="prepare" description="compile the source ">
<!-- Compile the java code from ${src.dir} into ${build.dir} -->
<javac classpathref="src.compile.classpath" srcdir="${src.dir}" includeantruntime="false" source="1.5" target="1.5" destdir="${classes.dir}" debug="true" />
<copy todir="${classes.dir}">
<fileset dir="${resources.dir}" includes="*.properties" />
</copy>
</target>
<!-- CORBETURA INSTRUMENT CLASSES -->
<target name="instrument.classes" depends="compile.sources">
<cobertura-instrument todir="${instrumentedclasses.dir}" datafile="${cobertura.datafile}">
<includeclasses regex=".*" />
<instrumentationClasspath>
<pathelement location="${classes.dir}" />
</instrumentationClasspath>
</cobertura-instrument>
</target>
<!-- COMPILE TEST CASES -->
<target name="compile.tests" depends="instrument.classes" description="compile test classes">
<javac classpathref="test.compile.classpath" srcdir="${test.dir}" source="1.5" target="1.5" destdir="${testclasses.dir}" debug="true" includeantruntime="false" />
<copy todir="${testclasses.dir}">
<fileset dir="${resources.dir}" includes="*.properties" />
</copy>
</target>
<!-- RUN TEST CASES -->
<target name="run.tests" depends="compile.tests" description="execute junit test cases">
<junit haltonfailure="false" printsummary="yes" showoutput="yes" fork="true">
<!-- junit-specific -->
<formatter type="xml" />
<classpath refid="test.runtime.classpath" />
<batchtest fork="yes" todir="${testReport.dir}">
<fileset dir="${test.dir}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
<!-- cobertura-specific -->
<sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura.datafile}" />
<classpath refid="cobertura.classpath" />
</junit>
<cobertura-report format="html" destdir="${cobertura.reports.dir}" datafile="${cobertura.datafile}" srcdir="${src.dir}" />
</target>
<!-- CREATE TEST CASE REPORT -->
<target name="report" depends="run.tests">
<junitreport todir="${testReport.dir}">
<fileset dir="${testReport.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${testReport.dir}" />
</junitreport>
</target>
</project>
I'm trying to run Cobertura with Ant, however always get this error in command line,
Note I'm on OSX, I couldn't figure out my directories correctly in the build.xml. Why does the command line search in /Users/jia/Java/Cobertura/cobertura-2.0.3 when I have already set different paths on the build.xml
BUILD FAILED
/Users/weimqu/Documents/workspace/Coverage1/build.xml:23: /Users/jia/Java/Cobertura/cobertura-2.0.3 does not exist.
Here's my build.xml
<project name="MyProject" default="coverage" basedir=".">
<description>
Ant build file
</description>
<!-- The properties are set in build.properties -->
<property file="build.properties" />
<property name="cobertura" location="../cobertura-src/cobertura-2.1.1" />
<path id="junit.classpath">
<fileset dir="${junit}">
<include name="*.jar" />
</fileset>
</path>
<path id="cobertura.classpath">
<fileset dir="${cobertura}">
<include name="cobertura.jar" />
<include name="lib/**/*.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory -->
<mkdir dir="${bin}"/>
<mkdir dir="${instrumented}" />
<mkdir dir="${reports.xml}" />
<mkdir dir="${reports.html}" />
<mkdir dir="${coverage.xml}" />
<mkdir dir="${coverage.summaryxml}" />
<mkdir dir="${coverage.html}" />
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${bin} -->
<javac includeantruntime="false"
srcdir="${src}"
destdir="${bin}"
debug="on">
<classpath refid="junit.classpath"/>
</javac>
</target>
<target name="test1" depends="compile">
<!-- Run junit tests -->
<junit printsummary="yes" fork="yes" haltonfailure="off">
<classpath location="${bin}"/>
<classpath refid="junit.classpath"/>
<formatter type="plain"/>
<test name="edu.depaul.se433.BinarySearchTest"/>
</junit>
</target>
<target name="instrument" depends="init,compile">
<!--
Remove the coverage data file and any old instrumentation.
-->
<delete file="cobertura.ser"/>
<delete dir="${instrumented}" />
<!--
Instrument the application classes, writing the
instrumented classes into ${instrumented}.
-->
<cobertura-instrument todir="${instrumented}">
<!--
The following line causes instrument to ignore any
source line containing a reference to log4j, for the
purposes of coverage reporting.
-->
<ignore regex="org.apache.log4j.*" />
<fileset dir="${bin}">
<!--
Instrument all the application classes, but
don't instrument the test classes.
-->
<include name="**/*.class" />
<exclude name="**/*Test.class" />
</fileset>
</cobertura-instrument>
</target>
<property name="testcase" value="edu.depaul.se433.BinarySearchTest" />
<target name="test2" depends="init,compile">
<junit fork="yes">
<!--
Note the classpath order: instrumented classes are before the
original (uninstrumented) classes. This is important.
-->
<classpath location="${instrumented}" />
<classpath location="${bin}" />
<classpath refid="junit.classpath" />
<!--
The instrumented classes reference classes used by the
Cobertura runtime, so Cobertura and its dependencies
must be on your classpath.
-->
<classpath refid="cobertura.classpath" />
<formatter type="xml" />
<test name="${testcase}" todir="${reports.xml}" if="testcase" />
<batchtest todir="${reports.xml}" unless="testcase">
<fileset dir="${src}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${reports.xml}">
<fileset dir="${reports.xml}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${reports.html}" />
</junitreport>
</target>
<target name="coverage-report-xml">
<!--
Generate an XML file containing the coverage data using
the "srcdir" attribute.
-->
<cobertura-report srcdir="${src}" destdir="${coverage.xml}" format="xml" />
</target>
<target name="summary-coverage-report">
<!--
Generate an summary XML file containing the coverage data using
the "srcdir" attribute.
-->
<cobertura-report srcdir="${src}" destdir="${coverage.summaryxml}" format="summaryXml" />
</target>
<target name="coverage-report-html">
<!--
Generate a series of HTML files containing the coverage
data in a user-readable form using nested source filesets.
-->
<cobertura-report destdir="${coverage.html}">
<fileset dir="${src}">
<include name="**/*.java"/>
<exclude name="**/*Test.java"/>
</fileset>
</cobertura-report>
</target>
<target name="coverage"
depends="compile,instrument,test2,coverage-report-xml,summary-coverage-report,coverage-report-html"
description="Compile, instrument ourself, run the tests and generate JUnit and coverage reports."/>
<target name="clean">
<!-- Delete the ${bin} folder -->
<delete dir="${bin}"/>
<delete dir="${instrumented}" />
<delete dir="${reports}" />
<delete file="cobertura.log" />
<delete file="cobertura.ser" />
</target>
</project>
And this is my files directory:
myProject:
build.properties
build.xml
cobertura-src/cobertura-2.1.1/conbertura files
junit/
src/edu/depaul/se433/
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 have a question about cobertura in a connection with Ant scripts. I have already read these two articles on StackOverflow:
SONAR - Measure Code Coverage using Cobertura and Bamboo + sonar.dynamicAnalysis=reuseReports = 0% Rules Compliance
Furthermore, I have searched in the internet for a solution for my problem.
Now I hope you can help me.
The initial situation:
I have an Ant script to compile a library and then a test target. Now I have added cobertura. After some time I got it out that the classes and also the ser file is stored. The report is also generated, but with no coverage.
But now the problem is that the JUnit test will not work. The following error message can be found in the xml:
<testcase classname="com.***.***.***.***.***Test" name="test16" time="0.0">
<error message="com/***/***/***/***/***Rule" type="java.lang.NoClassDefFoundError">java.lang.NoClassDefFoundError: com/***/***/***/***/***Rule
at com.***.***.***.***.***Test.setUp(Unknown Source)
at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
I currently use the following code in the Ant script:
<project name="MainLIB" default="vbuild" basedir="./">
<path id="path.additionaltasks">
<fileset dir="../BUILD/antlib">
<include name="cobertura.jar" />
<include name="log4j-1.2.9.jar" />
<include name="asm-3.0.jar" />
<include name="asm-tree-3.0.jar" />
<include name="jakarta-oro-2.0.8.jar" />
</fileset>
</path>
<taskdef resource="tasks.properties" classpathref="path.additionaltasks" />
<path id="path.LIB">
<fileset dir="lib" includes="**/**.jar" />
</path>
<path id="path.UNITTEST">
<path refid="path.LIB" />
<pathelement path="build/cobertura/classes" />
<pathelement path="build/classes" />
<pathelement path="build/test-classes" />
</path>
<property name="dir.build" value="build" />
<property name="dir.build.classes" value="${dir.build}/classes" />
<property name="dir.build.cobertura" value="${dir.build}/cobertura" />
<property name="dir.build.cobertura.classes" value="${dir.build.cobertura}/classes" />
<property name="dir.build.test.classes" value="${dir.build}/test-classes" />
<property name="dir.build.test.report" value="${dir.build}/test-reports" />
<property name="dir.build.dist" value="${dir.build}/dist" />
<target name="vbuild" depends="build,test" description="Build and run tests" />
<target name="build" description="Compile classes and create .jar file in build/dist">
<delete dir="${dir.build}" />
<mkdir dir="${dir.build.classes}" />
<javac srcdir="src" classpathref="path.LIB" verbose="false" destdir="${dir.build.classes}" includeantruntime="false" includejavaruntime="false" debug="true">
</javac>
<mkdir dir="${dir.build.dist}" />
<jar jarfile="${dir.build.dist}/${jar.name}.jar" basedir="${dir.build.classes}">
</jar>
</target>
<target name="test" description="Compile and Run jUnit Tests">
<mkdir dir="${dir.build.test.classes}" />
<mkdir dir="${dir.build.test.report}" />
<javac srcdir="test" classpathref="path.UNITTEST" verbose="false" destdir="${dir.build.test.classes}" includeantruntime="false" includejavaruntime="false">
</javac>
<delete dir="${dir.build.cobertura}" />
<mkdir dir="${dir.build.cobertura}" />
<mkdir dir="${dir.build.cobertura.classes}" />
<cobertura-instrument todir="${dir.build.cobertura.classes}" datafile="${dir.build.cobertura}/cobertura.ser">
<fileset dir="${dir.build.classes}" />
</cobertura-instrument>
<junit printsummary="yes">
<classpath>
<!--<pathelement path="build/cobertura/classes" />-->
<path refid="path.UNITTEST" />
</classpath>
<formatter type="xml" />
<batchtest todir="${dir.build.test.report}">
<fileset dir="${dir.build.test.classes}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
<cobertura-report format="xml" datafile="${dir.build.cobertura}/cobertura.ser" destdir="${dir.build.cobertura}/" />
<cobertura-report format="html" datafile="${dir.build.cobertura}/cobertura.ser" destdir="${dir.build.cobertura}/" />
</target>
The problem is, the classes are in the build/cobertura/classes directory. And I can't figure out, why Junit, can't find the classes
Your classpath:
<classpath>
<!--<pathelement path="build/cobertura/classes" />-->
<path refid="path.UNITTEST" />
</classpath>
Contains:
<path id="path.LIB">
<fileset dir="lib" includes="**/**.jar" />
</path>
<path id="path.UNITTEST">
<path refid="path.LIB" />
<pathelement path="build/cobertura/classes" />
<pathelement path="build/classes" />
<pathelement path="build/test-classes" />
</path>
But it also needs the cobertura jars, which you reference in path.additionaltasks. Cobertura instruments the class files with byte code manipluation. Those files still need the cobertura.jar dependency to work.
To fix it add the path.additionaltasks to junit:
<classpath>
<!--<pathelement path="build/cobertura/classes" />-->
<path refid="path.UNITTEST" />
<path refid="path.additionaltasks" />
</classpath>
I am trying to get Junit work with Ant. I have come across questions on the topic. I guess there is some small error somewhere but I can't figure it out. Here is my Build file:
<?xml version="1.0" encoding="UTF-8"?>
<project name="IvleFileSync" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<!-- Variables used for JUnit testing -->
<property name="test.dir" location="test" />
<property name="test.report.dir" location="test-reports" />
<path id="junit-classpath">
<fileset dir="${test.dir}">
<include name = "*" />
</fileset>
</path>
<path id="files-classpath">
<fileset dir="/usr/lib" >
<include name="*.jar"/>
</fileset>
</path>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<mkdir dir="${test.report.dir}" />
</target>
<target name="compile" depends="init" description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}">
<classpath>
<path refid="files-classpath" />
</classpath>
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/IvleFileSync-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="compile-test" depends="compile" description="compile the tests " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${test.dir}" destdir="${build}">
<classpath>
<path refid="files-classpath" />
</classpath>
</javac>
</target>
<target name="test" depends="compile-test" description="Execute Unit Tests" >
<junit printsummary="yes" fork="yes" haltonfailure="yes" showoutput="false">
<classpath >
<path refid="files-classpath" />
<path refid= "junit-classpath" />
</classpath>
<batchtest fork="yes" todir="${test.report.dir}/">
<formatter type="xml"/>
<fileset dir="${test.dir}">
<include name="*Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${test.report.dir}" />
<delete dir="${dist}"/>
</target>
</project>
And I have test files in /test directory as well as i have put the jars in ANT_HOME/lib
That does not work and I get this error when I dig up the test-results/....xml
<error message="NewEmptyJUnitTest" type="java.lang.ClassNotFoundException">java.lang.ClassNotFoundException: NewEmptyJUnitTest
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
Thanks for helping me out...
The classpath for the junit task does not include the output of the compile-test target. Use something like the following for the JUnit classpath:
<classpath>
<pathelement path="${build}"/>
<path refid="files-classpath" />
<path refid="junit-classpath" />
</classpath>
You forgot to add your own classes ("build") to the "test" target.