Ant与Junit配合来实现自动化测试
来源:互联网 发布:淘宝上新提醒我 编辑:程序博客网 时间:2024/06/03 16:01
看的教程中的案例代码,感觉太棒了!之前为什么不知道Ant有这么强大,因为之前都是一个人在战斗,下面是Ant与Junit配合实现了自动化测试盒生成测试文档的代码!
<?xml version="1.0" encoding="UTF-8"?>
<project name="junit-test"><property name="src.dir" location="src"></property>
<property name="test.src.dir" location="test"></property>
<property name="lib.dir" location="lib"></property>
<property name="build.dir" location="build"></property>
<property name="build.classes" location="${build.dir}/classes"></property>
<property name="build.test.dir" location="${build.dir}/test"></property>
<property name="build.test.classes" location="${build.test.dir}/classes"></property>
<property name="build.test.report" location="${build.test.dir}/report"></property>
<property name="run.test.class" value="**/Test*.class"></property>
<path id="compile-path">
<fileset dir="${lib.dir}" includes="*.jar"></fileset>
</path>
<path id="compile-test-path">
<path refid="compile-path"></path>
<pathelement location="${build.classes}"/>
</path>
<path id="run-test-path">
<path refid="compile-test-path"></path>
<pathelement location="${build.test.classes}"/>
</path>
<target name="clean">
<echo>进行项目的清理工作</echo>
<delete dir="${build.dir}"></delete>
</target>
<target name="init">
<echo>进行项目的初始化</echo>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.test.dir}"/>
<mkdir dir="${build.test.classes}"/>
<mkdir dir="${build.test.report}"/>
</target>
<target name="compile" depends="init">
<echo>编译源文件</echo>
<javac failonerror="true" includeantruntime="true" srcdir="${src.dir}" destdir="${build.classes}" classpathref="compile-path"></javac>
</target>
<target name="compile-test" depends="compile">
<echo>编译测试文件</echo>
<javac failonerror="true" includeantruntime="true" srcdir="${test.src.dir}" destdir="${build.test.classes}" classpathref="compile-test-path"/>
</target>
<target name="run-test" depends="compile-test">
<echo>运行单元测试</echo>
<junit printsummary="false" haltonfailure="false">
<classpath refid="run-test-path"></classpath>
<formatter type="brief" usefile="false"/>
<!--<test name="${run.test.class}"></test>-->
<formatter type="xml"/>
<batchtest todir="${build.test.report}">
<fileset dir="${build.test.classes}" includes="${run.test.class}"></fileset>
</batchtest>
</junit>
<junitreport todir="${build.test.report}">
<fileset dir="${build.test.report}" includes="TEST-*.xml"></fileset>
<report format="frames" todir="${build.test.report}/html"/>
</junitreport>
</target>
<target name="end" depends="run-test">
<echo>整个过程结束</echo>
</target>
</project>
0 0
- Ant与Junit配合来实现自动化测试
- 使用Ant与Junit进行自动化测试
- ANT+JUnit自动化测试
- Ant+junit的测试自动化
- Ant+junit的测试自动化
- Ant+junit的测试自动化
- Ant+junit的测试自动化
- ant整合junit自动化测试
- 使用Ant+JUnit+Cobertura来实现代码覆盖自动测试
- 用Ant和JUnit构建自动化测试
- ant+junit/testng/restAssured自动化测试配置
- 用Ant自动测试JUnit(Ant测试自动化--上)
- Ant集成Junit实现自动化测试的Build.xml模板详解
- 使用ANT实现自动化测试
- Ant build.xml 模版 (JUnit)自动化 增量测试
- Android自动化测试(Jenkins+Robotium+Ant+Junit)[PART one]
- Android自动化测试(Jenkins+Robotium+Ant+Junit)[PART TWO]
- Android自动化测试(Jenkins+Robotium+Ant+Junit)[PART one]
- ios检查内存泄露
- 《黑马程序员》基础加强---反射
- Linux学习路线指南
- ios7 对 scrollview做的一些改变(或者说是bug)
- iOS NSTimer的用法-下载进度显示
- Ant与Junit配合来实现自动化测试
- 解决PHP中json_encode函数处理中文乱码的问题 两种方法
- 用第三方会员系统(腾讯平台网站接入oauth)
- OCI连接oracle数据库,不用安装客户端(不需要tnsnames.ora来指定数据库ip地址),不需要服务命名
- JEECG开源社区招收学生说明
- 优秀程序员的6个共同特质
- Linux c/c++访问Oracle数据库--操作数据
- 指定序的排序问题,记一个学生的问题
- 使用Javascript 调用SharePoint Ribbon 命令