<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)航:
     
    主站蜘蛛池模板: 亚洲啪啪免费视频| 最近最好最新2019中文字幕免费| 中文字幕亚洲精品资源网| 国产男女猛烈无遮挡免费视频网站 | 亚洲αv久久久噜噜噜噜噜| 国产精品色午夜视频免费看| 久久精品成人免费网站| 青青青视频免费观看| 亚洲欧美成人综合久久久| 2022年亚洲午夜一区二区福利| 色噜噜亚洲精品中文字幕| 免费人成网站在线高清| 青青久在线视频免费观看| 99re免费99re在线视频手机版| 国产福利免费视频| 羞羞视频免费网站日本| 亚洲精品av无码喷奶水糖心| 亚洲人成在线精品| 亚洲成aⅴ人片在线影院八| 久久精品国产亚洲av成人| 亚洲日韩乱码中文无码蜜桃臀网站| 国产免费啪嗒啪嗒视频看看| 最近最新中文字幕完整版免费高清| 在线观看免费视频资源| 91免费福利精品国产| 国产成人免费视频| 日韩电影免费在线观看| 免费av一区二区三区| 久久精品免费观看| 精品在线免费观看| 久久免费视频观看| 日韩电影免费在线观看中文字幕| 大地资源中文在线观看免费版 | 久久99亚洲综合精品首页| 内射无码专区久久亚洲| 免费看小12萝裸体视频国产| 免费人成在线观看网站视频| 国产一级特黄高清免费大片| 免费国产成人午夜电影| 亚洲精品A在线观看| 国产亚洲精品无码专区|