久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

用Ant編譯,、junit測試,、生成測試報告、最終自動發(fā)mail

 pengx 2009-06-15
用Ant編譯,、junit測試,、生成測試報告、最終自動發(fā)mail
紅色部分是自己所寫,黑色部分是參照別人的,。,。。
測試通過的版本如下:
Eclipse:3.3.2
jdk:1.6
junit:3.8
ant:1.7(1.7之前的版本好像還不提供mail功能,。,。。)
<!-- JUnit build script using ant 1.7 -->
<project name="JunitTestProject" default="mail" basedir=".">
 <property name="app.name" value="JunitTestProject" />
 <property name="build.dir" value="bin" />
 <!-- ====================" path  define  " ================================ -->
 <path id="cobertura.classpath">
  <fileset dir="lib/coberture">
   <include name="cobertura.jar" />
   <include name="*.jar" />
  </fileset>
 </path>
 <!-- ====================" cobertura task define  " Target ================================ -->
 <taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
 <!-- ==================== "clean " Target ================================ -->
 <target name="clean">
  <available property="junit.present" classname="junit.framework.TestCase" />
  <delete dir="${build.dir}" quiet="true" />
  <delete file="report" quiet="true" />
 </target>
 <!-- ==================== "copy xml resource " Target ================================ -->
 <target name="copyxml" depends="clean">
  <copy todir="${build.dir}/testcases">
   <fileset dir="WEB-INF" />
  </copy>
 </target>
 <!-- ==================== "compile  src" Target ================================ -->
 <target name="compile" depends="copyxml">
  <mkdir dir="${build.dir}" />
  <javac srcdir="src" destdir="${build.dir}" debug="yes">
   <classpath>
    <fileset dir="lib" casesensitive="yes">
     <include name="**/*.jar" />
    </fileset>
   </classpath>
   <include name="**/*.java" />
  </javac>
  <javac srcdir="WEB-INF" destdir="${build.dir}">
   <classpath>
    <fileset dir="lib" casesensitive="yes">
     <include name="**/*.jar" />
    </fileset>
   </classpath>
   <include name="*.jsp" />
  </javac>
 </target>
 <!-- ==================== jar" Target ================================ -->
 <target name="jar" depends="compile">
  <mkdir dir="dist/lib" />
  <jar jarfile="dist/lib/${app.name}.jar" basedir="${build.dir}" includes="com/**" />
 </target>
 <!-- ==================== compile test src" Target ================================ -->
 <target name="compiletests" depends="jar">
  <mkdir dir="${build.dir}/testcases" />
  <javac srcdir="test" destdir="${build.dir}/testcases" >
   <classpath>
    <fileset dir="lib" casesensitive="yes">
     <include name="**/*.jar" />
    </fileset>
    <fileset dir="dist/lib" casesensitive="yes">
     <include name="**/*.jar" />
    </fileset>
   </classpath>
   <include name="**/*.java" />
  </javac>
 </target>
 <!-- ==================== instrumented" Target ================================ -->
 <target name="instrumented" depends="compiletests">
  <cobertura-instrument todir="bin/instrumented-classes">
   <ignore regex="org.apache.log4j.*" />
   <fileset dir="bin">
    <include name="com/**/*.class" />
   </fileset>
  </cobertura-instrument>
 </target>
 <!-- ==================== junit-test" Target ================================ -->
 <target name="runtests" depends="instrumented">
  <mkdir dir="report" />
  <property name="tests" value="*Test" />
  <junit printsummary="yes" haltonerror="yes" haltonfailure="yes" fork="yes">
   <formatter type="plain" usefile="false" />
   <formatter type="xml" />
   <batchtest todir="report">
    <fileset dir="test">
     <include name="**/${tests}.java" />
     <exclude name="**/ConfigTest.java" />
    </fileset>
   </batchtest>
   <!--
    Note the classpath order: instrumented classes are before the
    original (uninstrumented) classes.  This is important.
   -->
   <classpath location="bin/instrumented-classes" />
   <!--
    src classpath
   -->
   <classpath location="bin" />
   <!--
    The instrumented classes reference classes used by the
    Cobertura runtime, so Cobertura and its dependencies
    must be on your classpath.
   -->
   <classpath refid="cobertura.classpath" />
   <!--
    test case class path define
   -->
   <classpath>
    <fileset dir="lib" casesensitive="yes">
     <include name="**/*.jar" />
    </fileset>
    <pathelement location="bin/testcases" />
   </classpath>
  </junit>
 </target>
 <!-- ==================== junit-report" Target ================================ -->
 <target name="report" depends="runtests">
  <mkdir dir="report/html" />
  <junitreport todir="report">
   <fileset dir="report">
    <include name="TEST-*.xml" />
   </fileset>
   <report todir="report/html" />
  </junitreport>
 </target>

 <!-- ==================== "coverage-report" Target ================================ -->
 <target name="coverage-report" depends="report">
  <cobertura-report format="html" destdir="cobertura" >
   <fileset dir="src">
    <include name="**/*.java" />
   </fileset>
  </cobertura-report>
  <echo>The execution of coverage-report is complete. Coverage Reports are available in /${coverage-report}</echo>
 </target>
 
 <!-- ==================== "make file to zip" Target ================================ -->
 <target name="make_data_zip" depends="coverage-report">
  <tstamp>
   <format property="date" pattern="yyyy-MM-dd HH-mm" />
  </tstamp>
  <jar jarfile="dist/lib/cobertura${date}.zip" basedir="cobertura" />
  <jar jarfile="dist/lib/report${date}.zip" basedir="report" excludes="*.xml"/>
 </target>

<!-- ==================== "mail" Target ================================ -->
 <target name="mail" depends="make_data_zip">
  <!-- <taskdef name="mail" classname="org.apache.tools.ant.taskdefs.optional.mail.MimeMail"/> -->
  <tstamp/>
  <mail messageMimeType="text/html"
                    messageFile="message.txt"
                    tolist="[email protected]"
                    mailhost="mailsvr or mail IPAddress"
                    subject="JUnit Test Results: ${TODAY}"
                    from="[email protected]">
   <fileset dir=".">
    <include name="dist/lib/*.zip"/>
   </fileset>
  </mail>
 </target>
</project>

本文來自CSDN博客,,轉(zhuǎn)載請標明出處:http://blog.csdn.net/FrankGGYY/archive/2009/03/30/4036973.aspx

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點,。請注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,謹防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多