Ant 使用Junit自动测试要注意的问题
2007-05-16 13:56
441 查看
在构建Ant自动测试的时候,必须要加入ant_home/lib下的库,要不会出现ClassNotFound的异常。
<path id="test.classpath">
<fileset dir="${ant.library.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${test.home}/classes"/>
</path>
<target name="test" depends="all">
<mkdir dir="${test.report}"/>
<mkdir dir="${test.home}/classes"/>
<javac srcdir="${test.home}/src"
destdir="${test.home}/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="master-classpath"/>
</javac>
<junit printsummary="true"
fork="true"
haltonfailure="false"
failureproperty="tests.failed"
showoutput="true">
<classpath refid="test.cl
4000
asspath"/>
<classpath refid="master-classpath"/>
<formatter type="xml"/>
<batchtest todir="${test.report}">
<fileset dir="${test.home}/classes">
<include name="**/*Test.*"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.report}">
<fileset dir="${test.report}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test.report}"/>
</junitreport>
<fail if="tests.failed">
---------------------------------------------------------
One or more tests failed, check the report for detail...
---------------------------------------------------------
</fail>
</target>
<path id="test.classpath">
<fileset dir="${ant.library.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${test.home}/classes"/>
</path>
<target name="test" depends="all">
<mkdir dir="${test.report}"/>
<mkdir dir="${test.home}/classes"/>
<javac srcdir="${test.home}/src"
destdir="${test.home}/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="master-classpath"/>
</javac>
<junit printsummary="true"
fork="true"
haltonfailure="false"
failureproperty="tests.failed"
showoutput="true">
<classpath refid="test.cl
4000
asspath"/>
<classpath refid="master-classpath"/>
<formatter type="xml"/>
<batchtest todir="${test.report}">
<fileset dir="${test.home}/classes">
<include name="**/*Test.*"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.report}">
<fileset dir="${test.report}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test.report}"/>
</junitreport>
<fail if="tests.failed">
---------------------------------------------------------
One or more tests failed, check the report for detail...
---------------------------------------------------------
</fail>
</target>
相关文章推荐
- 使用Ant+JUnit+Cobertura来实现代码覆盖自动测试
- Ant+JUnit+Cobertura执行测试用例时,应注意的问题(以Apache POI为例)
- 使用Eclipse对JUnit测试函数进行Debug时断点无效问题
- 对基于JUnit和Ant的测试用例执行过程使用Kieker(AspectJ)进行监控的方法
- 使用Ant自动打包项目遇到的一个问题,备案!
- 使用Ant运行JUnit测试用例时,报java.lang.ClassNotFoundException: org.hamcrest.SelfDescribing的一种解决方案
- 使用jUnit对代码进行测试以及测试过程中遇到的问题
- Android 中使用JUnit进行自动测试
- ant集成junit自动测试的build.xml标准模板
- ant+junit实现TDD,自动测试
- 转: ant集成junit自动测试的build.xml标准模板
- 在Android中使用Junit测试注意事项
- selenium进阶之基础--web自动测试框架(ant+junit+selenium)
- 使用abator自动生成代码时要注意的问题
- 软件测试_JUnit+Ant构建自动的单元测试(1)
- 关于loadrunner使用socket测试应注意的问题
- 使用Ant进行Junit测试
- 基于JUnit和Ant测试程序正在运行使用Kieker(AspectJ)监测方法
- 【Java】使用Junit测试线程过程中出现的小问题
- 使用 Ant 集成 IBM Security AppScan Standard 进行自动测试