基于Ant+Selenium+TestNG的测试框架配置

<?xml version="1.0" encoding="UTF-8"?>
<!--This xml file build for Ant,default task "test" executed--> 
<project default="run-test">
  <property name="Framework-src" value="./src" />
  <property name="bin" value="./bin" />
  <property name="lib" value="./lib" />
  <property name="outputs" value="./report" />
  <property name="conf" value="./config" />

 <!--Set path-->  
 <path id="cp">
    <fileset dir="${lib}">
      <include name="**/*.jar"/>
    </fileset>
     <pathelement location="${bin}"/>
 </path>
 
 <path id="cp.jar">
    <fileset dir="${lib}" includes="*.jar"/>
 </path>
 
 <!--Compile all resource java file into class file-->  
  <target name="Compile">
  
   <javac srcdir="${Framework-src}" destdir="${bin}"
       classpathref="cp" />
  </target>
       
 <!--Define testng task-->

 <taskdef name="testngtest" classpathref="cp"
           classname="org.testng.TestNGAntTask" />

 <!--Define testng target-->  
  <target name="run_testNG">
   


    <testngtest classpathref="cp"
            useDefaultListeners="true"
            outputDir="${outputs}">
     <!--You can add one or more testcase xml here-->
      <xmlfileset dir="${bin}" includes="testng.xml"/>
    </testngtest>
  
   
  </target>
 

<!--使用生成Excel报告-->


   <target name="StartTest">
   <delete dir="${outputs}"/>
   <copy todir="${outputs}">
     <fileset file="${conf}/Report-Template.xls"/>
   </copy>
  <rename src="${outputs}/Report-Template.xls" dest="${outputs}/Report.xls"/>
   <java classname ="jd.main.RunTest" classpathref="cp" />
   </target>

 

<!--使用testng-results.xls美化报告-->

 <!--depends="run_testNG"-->
  <target name= "transform">
   <copy todir="${outputs}">
     <fileset file="${conf}/testng-results.xsl"/>
    </copy>
         <xslt in= "${outputs}/testng-results.xml" style= "${outputs}/testng-results.xsl" out= "${outputs}/index1.html">
              <!-- you need to specify the directory here again -->
             <classpath refid= "cp.jar" />
    <param name="testNgXslt.outputDir" expression="${basedir}/report"/>
    <param name="testNgXslt.showRuntimeTotals" expression="true"/>
         </xslt>

    </target>


 
 
 <!-- Run Test --> 
   <target name="run-test" description="Compile;Run TestNG;">
         <parallel>
             <sequential>
              <antcall target="Compile"></antcall>
     <antcall target="StartTest"></antcall>
                <!-- <antcall target="run_testNG"></antcall>-->
     <antcall target="transform"></antcall>
            </sequential>
        </parallel>
    </target>
 
</project>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值