敏捷开发学习之二_ant
2008-04-12 08:58
363 查看
注意:利用ant运行测试程序。
<?xml version="1.0"?>
<project name="agileJava" default="rebuildAll" basedir=".">
<property name="src.dir" value="${basedir}" />
<property name="build.dir" value="${basedir}classes" />
<property name="report.xml" value="${basedir}/junit/xml" />
<property name="report.html" value="${basedir}/junit/html" />
<path id="classpath">
<fileset dir="${src.dir}">
<include name="*.jar" />
</fileset>
<pathelement path="${build.dir}" />
</path>
<target name="init">
<mkdir dir="${build.dir}" />
<mkdir dir="${report.xml}" />
<mkdir dir="${report.html}"/>
</target>
<target name="build" depends="init" description="build all">
<javac srcdir="${src.dir}" destdir="${build.dir}" source="1.5" deprecation="on" debug="on" optimize="off" includes="**">
<classpath refid="classpath" />
</javac>
</target>
<!-- 运行测试用例,并生成xml-->
<target name="junitgui" depends="build" description="run junitgui">
<junit printsummary="yes" haltonfailure="no">
<classpath refid="classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${report.xml}">
<fileset dir="${build.dir}" includes="**/AllTests.class" />
</batchtest>
</junit>
</target>
<!-- 由生成的xml,生成html-->
<target name="report" depends="junitgui">
<junitreport todir="${report.html}">
<fileset dir="${report.xml}">
<include name="TEST-*.xml"/>
</fileset>
<report todir="${report.html}"/>
</junitreport>
</target>
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${report.xml}" />
<delete dir="${report.html}"/>
</target>
<target name="rebuildAll" depends="clean,build,junitgui,report" description="rebuild all" />
</project>
由于前面的测试用例,是采用的junit4的标注。如果
在ant中使用junit4还是有点问题。因为ant1.6.5等以前的版本不支持junit4。
必须去下载ant1.7.下载http://ant.apache.org/bindownload.cgi
如果出现错误:
ould not create task or type of type: junit.
Ant could not find the task or a class this task relies upon.
那:
you need to go into Eclipse then click on Window->Preferences->ant->Runtime,
then select 'Ant Home Entries (Default). Click on the button 'Add External JARs'.
Locate the junit.jar file you copied, select it and hit 'OK'. Hit 'Apply',
then 'OK' and try your ant task again. That should fix it.
<?xml version="1.0"?>
<project name="agileJava" default="rebuildAll" basedir=".">
<property name="src.dir" value="${basedir}" />
<property name="build.dir" value="${basedir}classes" />
<property name="report.xml" value="${basedir}/junit/xml" />
<property name="report.html" value="${basedir}/junit/html" />
<path id="classpath">
<fileset dir="${src.dir}">
<include name="*.jar" />
</fileset>
<pathelement path="${build.dir}" />
</path>
<target name="init">
<mkdir dir="${build.dir}" />
<mkdir dir="${report.xml}" />
<mkdir dir="${report.html}"/>
</target>
<target name="build" depends="init" description="build all">
<javac srcdir="${src.dir}" destdir="${build.dir}" source="1.5" deprecation="on" debug="on" optimize="off" includes="**">
<classpath refid="classpath" />
</javac>
</target>
<!-- 运行测试用例,并生成xml-->
<target name="junitgui" depends="build" description="run junitgui">
<junit printsummary="yes" haltonfailure="no">
<classpath refid="classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${report.xml}">
<fileset dir="${build.dir}" includes="**/AllTests.class" />
</batchtest>
</junit>
</target>
<!-- 由生成的xml,生成html-->
<target name="report" depends="junitgui">
<junitreport todir="${report.html}">
<fileset dir="${report.xml}">
<include name="TEST-*.xml"/>
</fileset>
<report todir="${report.html}"/>
</junitreport>
</target>
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${report.xml}" />
<delete dir="${report.html}"/>
</target>
<target name="rebuildAll" depends="clean,build,junitgui,report" description="rebuild all" />
</project>
由于前面的测试用例,是采用的junit4的标注。如果
在ant中使用junit4还是有点问题。因为ant1.6.5等以前的版本不支持junit4。
必须去下载ant1.7.下载http://ant.apache.org/bindownload.cgi
如果出现错误:
ould not create task or type of type: junit.
Ant could not find the task or a class this task relies upon.
那:
you need to go into Eclipse then click on Window->Preferences->ant->Runtime,
then select 'Ant Home Entries (Default). Click on the button 'Add External JARs'.
Locate the junit.jar file you copied, select it and hit 'OK'. Hit 'Apply',
then 'OK' and try your ant task again. That should fix it.
相关文章推荐
- 敏捷开发绩效管理之二:用中医理论管理团队及其绩效(绩效考核,团队管理,自组织团队)
- 敏捷开发学习笔记——用户故事与多职能团队
- AngularJS学习笔记之二:开发、调试和测试工具
- 敏捷开发“松结对编程”实践之二:计划与设计篇(大型研发团队,学习型团队,139团队,师徒制度,设计评审,预想陈述,共同估算,扑克牌估算)
- 敏捷开发学习笔记(一)
- 敏捷开发学习笔记
- 软件开发学习笔记 <二>软件开发模型、Up、Rup、敏捷Up
- 敏捷开发生态系统系列之二:敏捷生态系统-计划跟踪 I(跨职能团队-共同估算-每日立会-同行压力)
- 敏捷开发“松结对编程”实践之二:计划与设计篇(大型研发团队,学习型团队,139团队,师徒制度,设计评审,预想陈述,共同估算,扑克牌估算) .
- 快发掌握scrum敏捷开发学习要点
- CMMI与Agile敏捷开发比较之二:需求管理篇(兼谈用敏捷实现和满足CMMI的ReqM过程域)
- 项目经理的商务指南系列之二:认识责任(敏捷开发,专家与杂家)
- 【ARM-Linux开发】【CUDA开发】【深度学习与神经网络】Jetson Tx2安装相关之二
- 敏捷开发学习
- 敏捷开发一千零一问系列之十六:如何让开发人员学习产品?
- 敏捷开发学习总结(3): 思考开发文档的利与弊
- 敏捷开发系列学习总结(4)—Git管理工具sourcetree的安装
- 敏捷开发日常跟进系列之二:燃尽图(中)
- 敏捷开发用户故事系列之二:如何面向客户价值编写故事
- 敏捷开发系列学习总结(7)——敏捷开发的10大指导原则