xliujingweix

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
<?xml version = "1.0" encoding = "UTF-8" ?>
<project name="IHDS" default="test" basedir=".">
    <property name="src.dir" location="src" />
    <property name="tests.dir" location="test" />
    <property name="classes.dir" location="build/classes" />
    <property name="lib" location="WebContent/WEB-INF/lib" />
 
    <property name="report"   value="report"/>
    <property name="report.xml" value="${report}/junit/xml"/>
    <property name="report.html" value="${report}/junit/html"/>
 
    <property environment="env"/>
    <property name="tomcat.home" value="${env.CATALINA_HOME}"/>
 
    <path id="compile.classpath">
        <fileset dir="${lib}" includes="*.jar"/><!--excludes="" -->
        <fileset dir="${tomcat.home}/lib" includes="*.jar" />
    </path>
 
    <path id="test.classpath">
        <path refid="compile.classpath"/>
        <pathelement location="${classes.dir}"/>
    </path>
 
    <target name="init">
        <delete dir="${report}"/>
        <delete dir="${classes.dir}"/>
    </target>
 
    <target name="compile" depends="init" description="Compile Java code">
        <mkdir dir="${classes.dir}" />
        <javac srcdir="${src.dir}" destdir="${classes.dir}" >
            <classpath refid="compile.classpath"/>
        </javac>
        <copy todir="${classes.dir}">
            <fileset dir="${src.dir}">
                <include name="**/*.xml" />
                <include name="**/*.properties" />
            </fileset>
        </copy>
    </target>
 
    <target name="compile-tests" depends="compile" description="Compile Unit Tests">
        <javac srcdir="${tests.dir}" destdir="${classes.dir}">
            <classpath refid="test.classpath"/>
        </javac>
    </target>
 
    <target name="test" depends="compile-tests"  description="Run unit tests">
        <mkdir dir="${report.xml}"/>
        <mkdir dir="${report.html}"/>
 
        <junit printsummary="yes" haltonfailure="no">
            <classpath refid="test.classpath" />
            <formatter type="xml"/>
            <batchtest fork="yes" todir="${report.xml}">
                <fileset dir="${tests.dir}">
                    <include name="**/*Test.java" />
                	<exclude name="cn/aug/action/BaseTest.java"/>
                </fileset>
            </batchtest>
        </junit>
 
        <junitreport todir="${report.html}">
            <fileset dir="${report.xml}">
                <include name="*.xml"/>
            </fileset>
            <report format="frames" todir="${report.html}"/>
        </junitreport>
    </target>
</project>

 

posted on 2012-04-29 18:41  xliujingweix  阅读(568)  评论(0编辑  收藏  举报