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

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

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

    隨筆-77  評(píng)論-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"/>
     <!-- 需要測(cè)試的代碼生成的代碼路徑-->
     <property name="classes.dir" value="${build.dir}/classes"/>

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

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

     <!-- junit 生成兩種測(cè)試報(bào)告的路徑,xml和html-->
     <property name="reports.xml.dir" value="${reports.dir}/junit-xml"/>
     <property name="reports.html.dir" value="${reports.dir}/junit-html"/>
     
     <!-- cobertura生成的兩種測(cè)試覆蓋呂的報(bào)告,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" />
     <!--測(cè)試代碼的路徑-->
     <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>


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

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


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 免费无码国产在线观国内自拍中文字幕| 亚洲精品亚洲人成在线观看麻豆 | 欧洲一级毛片免费| 永久免费av无码不卡在线观看| 国产一精品一AV一免费孕妇| 亚洲黄色高清视频| **aaaaa毛片免费同男同女| 亚洲国产天堂在线观看| 免费A级毛片无码专区| 亚洲欧洲校园自拍都市| a毛片基地免费全部视频| 亚洲精华国产精华精华液网站| 国产美女亚洲精品久久久综合| 日本精品久久久久久久久免费| 亚洲一区二区三区无码影院| 中文字幕免费观看视频| 亚洲国产成人久久综合一| 亚洲一区二区三区免费视频| 亚洲五月丁香综合视频| 国外成人免费高清激情视频| 美女视频黄.免费网址| 亚洲欧洲日产国码无码网站| 91青青国产在线观看免费| ASS亚洲熟妇毛茸茸PICS| 四虎影库久免费视频| 中国一级特黄的片子免费 | 57pao国产成视频免费播放| 精品国产日韩久久亚洲| 亚洲AV蜜桃永久无码精品| 免费在线看黄网站| 免费久久精品国产片香蕉| 怡红院免费的全部视频| 亚洲成在人线电影天堂色| 免费**毛片在线播放直播| 免费污视频在线观看| 亚洲夂夂婷婷色拍WW47| 国产亚洲美女精品久久久| 中文字幕免费在线看线人| 美女扒开屁股让男人桶爽免费| 国产成人亚洲精品青草天美| 成年女人免费碰碰视频|