• selenium +TestNG+ reportng 的ant配置


    <project name="AUTO_TEST" basedir="." default="run_tests">
    
        <property name="src" value="src" />
    
        <property name="dest" value="classes" />
    
        <property name="lib.dir" value="${basedir}/lib" />
    
        <property name="output.dir" value="${basedir}/test-output" />
    
        <!--<property name="testcase" value="${src}/com/selenium/testcase" />-->
    
        <path id="compile.path">
    
            <fileset dir="${lib.dir}/">
    
                <include name="*.jar" />
    
            </fileset>
    
            <pathelement location="${src}" />
    
            <pathelement location="${dest}" />
    
        </path>
    
        <target name="init">
    
            <mkdir dir="${dest}" />
    
            <!--<delete dir="${dest}"></delete>
    
            <delete dir="${testcase}"></delete>
    
            <mkdir dir="${dest}" />-->
    
        </target>
    
        <target name="compile" depends="init">
    
            <echo>compile tests</echo>
    
            <javac srcdir="${src}" destdir="${dest}" encoding="UTF-8"
    
                   classpathref="compile.path" />
    
        </target>
    
       <!-- <target name="run"  depends ="compile">
    
            <java classname ="Proxy">
    
                <classpath>
    
                    <pathelement path="${dest}/com/selenium/util"/>
    
                </classpath>
    
            </java>
    
        </target>-->
    
        <taskdef resource="testngtasks" classpath="${lib.dir}/testng-6.8.5.jar" />
    
       <!-- <taskdef name="testng" classname="${dest}/org.testng.TestNGAntTask"/>-->
    
        <!-- 开始测试 -->
    
        <target name="run_tests" depends="compile">
    
            <echo>running tests</echo>
    
            <testng classpathref="compile.path" outputdir="${output.dir}"
    
                    haltonfailure="no"
    
                    failureproperty="failed"
    
                    parallel="true"
    
                    useDefaultListeners="true"
    
                    listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter"
    
                    threadCount="3" >
    
                <xmlfileset dir="${basedir}/src/com/selenium" includes="TestNG1.xml" />
    
                <classfileset dir="${dest}">
    
                    <include name="/*.class" />
    
                </classfileset>
    
                <sysproperty key="org.uncommons.reportng.title" value="My Test Report"/>
    
            </testng>
    
            <!--<antcall target="transform1" />-->
    
            <!-- <fail message="TEST FAILURE" if="failed" /> -->
    
        </target>
    
        <target name="transform1" description="report">
    
        <testng classpathref="compile.path"
    
                outputdir="${output.dir}"
    
                haltonfailure="true"
    
                useDefaultListeners="false"
    
                listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter">
    
            <xmlfileset dir="${basedir}/src/com/selenium" includes="TestNG1.xml"/>
    
            <sysproperty key="org.uncommons.reportng.title" value="My Test Report"/>
    
        </testng>
    
        </target>
    
        <!-- 生成报告 -->
    
        <target name="transform" description="report">
    
            <xslt
    
                    in="${output.dir}/testng-results.xml"
    
                    style="${output.dir}/testng-results.xsl"
    
                    out="${output.dir}/Report.html"
    
                    force="yes">
    
                <!-- you need to specify the directory here again -->
    
                <param name="testNgXslt.outputDir" expression="${output.dir}" />
    
                <classpath refid="compile.path" />
    
            </xslt>
    
        </target>
    
    </project>
    
     
  • 相关阅读:
    实验证明:ObjectiveC++ 完美支持 ARC
    用 Java 实现的日志切割清理工具
    数字电视,方便了谁
    商品EAN13条码的生成
    关于错误“Cannot connect to the Citrix MetaFrame server.Can't assign requested address”的解决方法
    "加载类型库/dll时出错" 的解决方法
    解决连接SQL Server 2000的TCP/IP错误的Bug
    电脑自动关机之CPU风扇烧坏
    winrar 8 注册方法
    电脑死机之CPU温度过高
  • 原文地址:https://www.cnblogs.com/zhangminjie/p/3959761.html
Copyright © 2020-2023  润新知