首页 > 学院 > 开发设计 > 正文

Java应用利器组合:Ant+JUnit+Cobertura

2019-11-18 15:30:10
字体:
来源:转载
供稿:网友

    看标题就知道,这个是开发一个java应用的利器组合,使用Ant完成工程的构建(Build),使用JUnit完成单元测试,使用Cobertura完成代码覆盖测试,也可以辅助查找性能瓶颈和一些类型的BUG,

下面是一个完整的build.xml范例,可以完全拿来用,不需任何修改,只要你的目录和这里的目录一致(应该也是很通用的):

下载下面的build.xml文件

文件内容:
<PRoject default="all">
    <!– =================================================================== –>
    <!–                               Definitions                           –>
    <!– =================================================================== –>   
    <property name="base-dir" location="." />
    <property name="lib-dir" location="${base-dir}/lib" />
    <property name="src-dir" location="${base-dir}/src" />
    <property name="testcase-dir" location="${base-dir}/test" />
    <property name="out-dir" location="${base-dir}/classes" />
    <property name="report-dir" location="${base-dir}/report" />
    <property name="junit-dir" location="${report-dir}/junit" />
    <property name="junit-xml-dir" location="${junit-dir}/xml" />
    <property name="junit-Html-dir" location="${junit-dir}/html" />
    <property name="cobertura-dir" location="${report-dir}/cobertura" />
    <property name="cobertura-xml-dir" location="${cobertura-dir}/xml" />
    <property name="cobertura-html-dir" location="${cobertura-dir}/html" />
    <property name="instrumented-dir" location="${report-dir}/instrumented" />
    <property name="instrument-file" location="${instrumented-dir}/cobertura.ser" />
    <property name="cobertura.dir" value="${instrumented-dir}" />
   
   
    <path id="classpath.all">
        <pathelement location="${out-dir}" />
        <fileset id="alljars" dir="${lib-dir}">
            <include name="**/*.jar" />
        </fileset>
    </path>



发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表