敏捷开发学习之二_ant
来源:互联网 发布:http js.shxedc.com 编辑:程序博客网 时间:2024/05/01 18:12
注意:利用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>
<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.
- 敏捷开发学习之二_ant
- 敏捷开发学习笔记(二)
- 敏捷开发智慧敏捷系列之二:写不写文档?
- 敏捷开发智慧敏捷系列之二:写不写文档? .
- 敏捷开发学习笔记(二)
- 敏捷开发修炼之道(二)
- 敏捷开发之如何打造敏捷团队--学习讨论会总结
- 敏捷开发学习之三_EnumMap用法
- 敏捷开发二
- 敏捷开发一千零一问系列之二十五:什么是敏捷开发的根本基础?
- 敏捷开发产品管理系列之二:产品版本规划
- 敏捷开发日常跟进系列之二:燃尽图(中)
- 敏捷开发之道(二)极限编程XP
- 【火星人敏捷开发云】上线之二:产品驱动模式
- Web开发敏捷之道学习(二)
- 游戏敏捷开发项目管理之我见(二)
- 敏捷开发一千零一问系列之二十四:传统团队如何转变为敏捷团队(一)?
- 敏捷开发一千零一问系列之二十九:敏捷如何估算(上)?
- Asp.Net toString() 的妙用[处理日期,字符型转换 转为字符串]
- ext:初学(2) -layout 和 tree的结合
- 【Tutorial】Target & Action, 另外一种响应事件的方法
- 产品经理的主要职责
- 产品经理(PM)职责介绍
- 敏捷开发学习之二_ant
- PHP文件类-上传,样图,文件夹内容浏览删除
- 佛祖说出的爱情箴言
- 十个习惯让你精通新的开发技术
- "Cannot forward after response has been committed "错误的正确解决方法
- Struts logic:iterate标签的总结
- 加班赶工,得不偿失——历史给你上六课
- 企业管理软件平台架构内幕揭秘
- Eclipse下使用jxl