I have a gwt project, and i want to do the unit test in my project, so i add a target of junit in the ant build file. But the build always fails,
BUILD FAILED C:\SG\workspace\app\build.xml:78: The for must include junit.jar if not in Ant’s own classpath
here is the scripts
<target name="test" depends="clean.test,gwtc" description="run all Junit tests">
<mkdir dir ="test/test"/>
**<junit fork = "false" printsummary = "yes"/>** <!-- the line 78-->
<classpath refid = "project.class.path"/>
<batchtest todir = "test/test">
<fileset dir = "test" includes="**/${test}Test.java"/>
</batchtest>
<formatter type = "xml"/>
<junitreport toDir = "test/test">
<fileset dir = "test/test"/>
<report format="frames" todir="test"/>
</junitreport>
<exec os="window" executable="cmd.exe">
<arg line="-a /Applications/Safari.app test/index.html"/>
</exec>
</target>
You closed the
<junit />tag too early.This is correct.
classpath,batchtestandformatterhave to be inside thejunitTag:And you have to make sure that
junit.jaris either in ANT_HOME/lib, referenced in project.class.path or added as another classpath like<classpath refid = "junit.class.path"/>.