2014-12-19 88 views
0

這是我的build.xml文件。我正在嘗試撥打testNG.xml文件來執行它從build.xml但我越來越低於錯誤。未能創建任務或類型testng

<property name="bin.dir" value="${basedir}/bin" /> 
<property name="lib.dir" value="${basedir}/lib" /> 
<property name="src.dir" value="${basedir}/src" /> 
<property name="res.dir" value="${basedir}/resources" /> 
<property name="server.dir" value="${basedir}/server" /> 

<path id="seleniumautomation.classpath"> 
    <!-- <pathelement path="${lib.dir}" /> --> 
    <fileset dir="${lib.dir}"> 
    <include name="*.jar" /> 
    <include name="**/*.jar" /> 
    </fileset> 
    <!--<fileset dir="${basedir}/server"> <include name="*.jar" /> <include 
    name="**/*.jar" /> </fileset> --> 
</path> 

<target name="clean"> 
    <echo>Clean data</echo> 
    <delete failonerror="false" dir="lib"/> 
</target> 

<target name="create" depends="clean"> 
    <echo>Creating directory.</echo> 
    <mkdir dir="lib"/> 
</target> 

<target name="copy" depends="create"> 
    <echo>Coping jars</echo> 
    <copy todir="lib" overwrite="true"> 
     <fileset dir="C:\backup\ToolsQA\ProjectThree\JarFiles" includes="**/*.jar" id="id" >  
     </fileset> 
    </copy> 
</target> 

<target name="compile" depends="copy"> 
    <javac classpathref="seleniumautomation.classpath" includeantruntime="true" srcdir="src" destdir="bin" includes="**/*.java" verbose="true" > 
    </javac> 
    <echo>Java file compiled Successfully.</echo> 
</target> 

    <target name="runtests" depends="compile"> 
     <echo>ABCFD</echo> 
      <testng classpathref="seleniumautomation.classpath" useDefaultListeners="true"> 
      <echo>2431234ABCFD</echo> 
      <xmlfileset dir="${basedir}" includes="TestNG.xml" />  
      </testng> 
    </target> 

建立失效的C:\備份\ ToolsQA \ ProjectThree \ build.xml中:65:問題: 無法創建任務或類型TestNG的原因:這個名字是未定義。 操作:檢查拼寫。操作:檢查是否已聲明任何自定義任務/類型 。行動:檢查是否有任何/ 聲明已經發生。

請建議....

回答

0

你缺少的taskdef標記,如:

<taskdef resource="testngtasks" classpath="<Path where testng jar is in >/testng.jar"/> 
相關問題