java中标准的build.xml配置文件

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir= "D:\selenium\AutoTest" default="build" name="AutoTest" >    
    <!--配置基本属性-->
    <property name="src" value="src\CommonMain"/>
    <property name=" build "   value=" build " />
    <property name="lib" value="lib"/>
    <property name="dist" value="dist"/>
    <property name="classpath" location="${bin}"/>
    
    <!--配置测试报告的属性-->
    <property name="report" value="report"/>
    <property name="report.xml" value="${report}/junit/xml"/>
    <property name="report.html" value="${report}/junit/html"/>

    <!--配置运行时classpath-->
    <path id="classpath.run">
        <pathelement path="${classpath}"/>
        <fileset dir="${lib}">
            <include name="*.jar"/>
        </fileset>
    </path>

    <!--配置测试时classpath-->
    <path id="classpath.test">
    <path refid="classpath.run"/>
        <path location="${dist}/lib/*.jar"/>
    </path>

    <!--任务初始化-->
    <target name="init">
        <tstamp/>
            <mkdir dir="${ build }" />
    </target>

    <!--配置编译任务-->
    <target name="compile" depends="init">
        <javac destdir="${ build }"   srcdir="${src}"   includeantruntime="on">
            <classpath refid="classpath.run"/>
        </javac>
    </target>

    <!--配置打包任务-->
    <target name="dist" depends="compile">
        <mkdir dir="${dist}/lib"/>
        <jar basedir="${bin}" jarfile="${dist}/lib/*.jar"/>
    </target>

    <!--配置运行任务-->
    <target name="run" depends="compile, dist">
        <java classname="${ build }/PublicSuite.class" >
        <classpath>
            <path refid="classpath.run"/>
        </classpath>
    </java>
    </target>

    <!--配置JUnit测试,打印测试结果-->
    <target name="build" depends="compile, dist">
        <mkdir dir="${report.xml}"/>
        <mkdir dir="${report.html}"/>
        <junit haltonfailure="no" printsummary="yes">
        <classpath refid="classpath.run"/>
            <formatter type="xml"/>
            <batchtest todir="${report.xml}" fork="yes">
        <fileset dir="${src}" includes="**/Test*.java"/>
    </batchtest>
    </junit>
    
        <junitreport todir="${report.html}">
            <fileset dir="${report.xml}">
            <include name="*.xml"/>
            </fileset>
            <report todir="${report.html}" format="frames"/>
        </junitreport>
    </target>        

</project>  



  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值