Ant 与 JUnit 结合的一个例子
<project name="junitSample" default="test">
<target name="init">
<property name="outdir" value="/home/AD/temp/junitSample"/>
<property name="reportdir" value="./report/html"/>
</target>
<target name="prepare" depends="init">
<mkdir dir="${outdir}"/>
<mkdir dir="${reportdir}"/>
</target>
<target name="compile" depends="prepare">
<javac srcdir="./src" destdir="${outdir}"
classpath="junit.jar"/>
</target>
<target name="test" depends="compile">
<junit printsummary="true">
<formatter type="xml"/>
<formatter type="plain"/>
<test name="junit.samples.AllTests"/>
<test name="xptoolkit.junit.example.HashMapTest"/>
<classpath>
<pathelement location="${outdir}"/>
</classpath>
</junit>
<junitreport todir="./report">
<fileset dir=".">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${reportdir}"/>
</junitreport>
</target>
</project>
本文介绍了一个使用Ant构建工具与JUnit测试框架结合的例子。通过配置Ant的build文件,实现了项目的初始化、准备、编译和测试等阶段。示例中包含了JUnit测试用例的执行及测试报告的生成。
3100

被折叠的 条评论
为什么被折叠?



