<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-77  評論-5  文章-2  trackbacks-0

    <?xml version="1.0" encoding="UTF-8"?>

    <project name="cobertura.examples.basic" default="coverage" basedir=".">

     <description>
        Cobertura - http://cobertura.sourceforge.net/
        Copyright (C) 2003 jcoverage ltd.
        Copyright (C) 2005 Mark Doliner &lt;thekingant@users.sourceforge.net&gt;
        Cobertura is licensed under the GNU General Public License
        Cobertura comes with ABSOLUTELY NO WARRANTY
        </description>

     
     <property name="build.dir" value="${basedir}/build"/>
     <!-- 需要測試的代碼生成的代碼路徑-->
     <property name="classes.dir" value="${build.dir}/classes"/>

     <!-- 為需要測試的代碼生成的對應的測量類,用于測量覆蓋率-->
     <property name="instrumented.dir" value="${build.dir}/instrumented-classes"/>

     
     <!-- 單元測試的代碼,這部分代碼不生成覆蓋率數(shù)據(jù),因此和待測試代碼要分開-->
     <property name="test.classes.dir" value="${build.dir}/test-classes"/>
     
     <!-- 所有報告的路徑-->
     <property name="reports.dir" value="${build.dir}/reports"/>

     <!-- junit 生成兩種測試報告的路徑,xml和html-->
     <property name="reports.xml.dir" value="${reports.dir}/junit-xml"/>
     <property name="reports.html.dir" value="${reports.dir}/junit-html"/>
     
     <!-- cobertura生成的兩種測試覆蓋呂的報告,xml和html-->
     <property name="coverage.xml.dir" value="${reports.dir}/cobertura-xml"/>
     <property name="coverage.html.dir" value="${reports.dir}/cobertura-html"/>
     
     
     <property name="src.dir" value="${basedir}/src" />
     <!--測試代碼的路徑-->
     <property name="test.dir" value="${basedir}/test" />

     
     <path id="cobertura.classpath">
      <fileset dir="${basedir}">
       <include name="lib/unittest/*.jar" />
      </fileset>
     </path>

     <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>

     <target name="init">
      <mkdir dir="${build.dir}" />
      <mkdir dir="${classes.dir}" />
      <mkdir dir="${test.classes.dir}" />
      <mkdir dir="${instrumented.dir}" />
      <mkdir dir="${reports.xml.dir}" />
      <mkdir dir="${reports.html.dir}" />
      <mkdir dir="${coverage.xml.dir}" />
      <mkdir dir="${coverage.html.dir}" />
     </target>

     <target name="compile" depends="init">
      <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="yes">
       <classpath refid="cobertura.classpath" />
      </javac>
     </target>
     
     
     <target name="compiletest" depends="compile">
      <javac srcdir="${test.dir}" destdir="${test.classes.dir}" debug="yes">
       <classpath location="${classes.dir}"/>
       <classpath refid="cobertura.classpath" />
      </javac>
     </target>

     <target name="instrument" depends="init,compile">
      <!--
       Remove the coverage data file and any old instrumentation.
      -->
      <delete file="cobertura.ser"/>
      <delete dir="${instrumented.dir}" />

      <!--
       Instrument the application classes, writing the
       instrumented classes into ${build.instrumented.dir}.
      -->
      <cobertura-instrument todir="${instrumented.dir}">
       <!--
        The following line causes instrument to ignore any
        source line containing a reference to log4j, for the
        purposes of coverage reporting.
       -->
       <ignore regex="org.apache.log4j.*" />

       <fileset dir="${classes.dir}">
        <!--
         Instrument all the application classes, but
         don't instrument the test classes.
        -->
        <include name="**/*.class" />
        <exclude name="**/*Test.class" />
       </fileset>
      </cobertura-instrument>
     </target>

     <target name="test" depends="init,compiletest">
      <junit fork="yes" dir="${basedir}" haltonerror="no" failureProperty="test.failed">
       <!--
        Note the classpath order: instrumented classes are before the
        original (uninstrumented) classes.  This is important.
       -->
       <classpath location="${instrumented.dir}" />
       <classpath location="${classes.dir}" />
       <classpath location="${test.classes.dir}" />
       <!--
        The instrumented classes reference classes used by the
        Cobertura runtime, so Cobertura and its dependencies
        must be on your classpath.
       -->
       <classpath refid="cobertura.classpath" />

       <formatter type="xml" />
       <test name="${testcase}" todir="${reports.xml.dir}" if="testcase" />
       <batchtest todir="${reports.xml.dir}" unless="testcase">
        <fileset dir="${test.dir}">
         <include name="**/*Test.java" />
        </fileset>
       </batchtest>
      </junit>

      <junitreport >
       <fileset dir="${reports.xml.dir}">
        <include name="TEST-*.xml" />
       </fileset>
       <report format="frames" todir="${reports.html.dir}" />
      </junitreport>
     </target>

     <target name="coverage-check">
      <cobertura-check branchrate="34" totallinerate="100" />
     </target>

     <target name="coverage-report">
      <!--
       Generate an XML file containing the coverage data using
       the "srcdir" attribute.
      -->
      <cobertura-report srcdir="${src.dir}" destdir="${coverage.xml.dir}" format="xml" />
     </target>

     <target name="alternate-coverage-report">
      <!--
       Generate a series of HTML files containing the coverage
       data in a user-readable form using nested source filesets.
      -->
      <cobertura-report destdir="${coverage.html.dir}">
       <fileset dir="${src.dir}">
        <include name="**/*.java"/>
       </fileset>
      </cobertura-report>
     </target>

     <target name="clean" description="Remove all files created by the build/test process.">
      <delete dir="${build.dir}" />
      <delete dir="${classes.dir}" />
      <delete dir="${instrumented.dir}" />
      <delete dir="${reports.dir}" />
      <delete file="cobertura.log" />
      <delete file="cobertura.ser" />
     </target>

     <target name="coverage" depends="clean,compile,instrument,test,coverage-report,alternate-coverage-report" description="Compile, instrument ourself, run the tests and generate JUnit and coverage reports."/>

    </project>


    文章來源:http://stocknewbie.bokee.com/viewdiary.15201790.html
    posted on 2009-05-01 10:52 huohuo 閱讀(673) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導航:
     
    主站蜘蛛池模板: 久久综合亚洲色一区二区三区 | 亚洲一区二区三区无码国产| 男人天堂免费视频| 精品亚洲一区二区三区在线观看 | 午夜免费福利网站| 亚洲国产成人精品无码区花野真一 | 亚洲一区影音先锋色资源| 久久午夜免费鲁丝片| 亚洲大片在线观看| 57pao国产成视频免费播放| 亚洲区视频在线观看| 青草草色A免费观看在线| ASS亚洲熟妇毛茸茸PICS| 波多野结衣久久高清免费 | 四虎在线最新永久免费| 91亚洲自偷在线观看国产馆| 毛片a级毛片免费观看品善网| 国产精品亚洲精品| 国内精品免费视频自在线| 国产成人精品久久亚洲高清不卡| 日产乱码一卡二卡三免费| 一进一出60分钟免费视频| 亚洲精品二区国产综合野狼| 99爱在线精品视频免费观看9| 亚洲校园春色小说| 女人18毛片免费观看| 免费人成网站永久| 亚洲av不卡一区二区三区| 黄色片在线免费观看 | 亚洲av永久无码一区二区三区| 免费观看国产小粉嫩喷水| 久久毛片免费看一区二区三区| 亚洲无线电影官网| 日韩免费观看的一级毛片| 久久久WWW免费人成精品| 亚洲美女视频一区| 免费人成激情视频| 久操免费在线观看| 国产AV无码专区亚洲AV麻豆丫| 亚洲国产另类久久久精品| 黄色永久免费网站|