One, the configuration of the jar package required to support ant <junit> tasks.
Note:this task depends on external libraries not included in the Ant distribution. dependencies for more information.
Note: The JUnit character relies on an optional library, not included in the standard Ant.jar.
Note:you must have Junit.jar and the class files for the <junit> task in the same classpath. Can do one of:
Note: You must have Junit.jar, and this class file must be under the same ant path
Put both Junit.jar and the optional tasks jar file in Ant_home/lib.
1, put the Junit.jar and optional task jar (Optional.jar) files into the Ant_home/lib directory. environment variable ant_home = **\ant such a directory.
Don't put either in Ant_home/lib, and instead include their locations in your CLASSPATH environment.
2, if you do not put the Junit.jar and optional task jar (Optional.jar) files into the Ant_home/lib directory, you can do this by writing the absolute path (including the filename) of the two jar files into your system environment variable CLASSPATH.
Do neither of the above, and instead, specify their locations using a <classpath> element in the build file. The FAQ for details.
3, if you do not want to do the above 2 methods, then you can:
In build file ant, use the <classpath> element to specify the location of the Junit.jar and optional task jar (Optional.jar) files.
Here are some examples of success:
<?xml version= "1.0"
<project name= "project" default= "JUnit"
<property name= " Run.classpath "value=" Bin "></property>"
<property name= "Run.srcpath" value= "src" ></property
<property name= "Test.srcpath" value= "test" ></PROPERTY>
<property name= "Test.report" Value= "></property>"
<property name= "Lib.dir" Value= "Lib"/>
<path id= "Compile.path"
<fileset dir= "${lib.dir}"
<include name= "**/*.jar"/>
</fileset>
</path
<!--compilation Classpath
<path id= "Compile.classpath"
<fileset dir= "${telecom_" LDBS.lib} "
<include name=" **/*.jar "/>
</fileset>
</path>
;
<target Name= "Compile"
<javac destdir= "${run.classpath}" srcdir= "${run.srcpath}"
classpathref= "Compile.path" "/>
<javac destdir=" ${run.classpath} "srcdir=" ${test.srcpath} "
classpathref=" CompiLe.path "/>
</target>
<target name=" JUnit "depends=" compile "
<tstamp/>
< mkdir dir= "${test.report}"/>
<mkdir dir= "${test.report}/framework-${dstamp}-${tstamp}"/>
< JUnit printsummary= "true"
<classpath
<pathelement path= "${run.classpath}"/>
< Fileset dir= "${lib.dir}"
<include name= "**/*.jar"/>
</fileset>
</classpath>
<!--
<test name= "Ldbs1adslsectionbaseinfomodelservicetest" ></TEST>
<formatter Type= "plain"/>
<!--She zhi Yao ce shi de Wen Jian ji he;
<batchtest fork= "yes" todir= Rt}/framework-${dstamp}-${tstamp} "
<fileset dir=" ${test.srcpath} "
<include name=" **/* Test.java "/>
</fileset>
</batchtest>
</junit>
</target>
</project