【问题标题】:failed to create task or type testng未能创建任务或类型 testng
【发布时间】:2015-02-18 05:12:41
【问题描述】:

这是我的build.xml 文件。我正在尝试调用testNG.xml 文件以从build.xml 执行它,但我遇到了错误。

 <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:\backup\ToolsQA\ProjectThree\Build.xml:65: 问题: 未能创建任务或类型 testng 原因:名称未定义。 行动:检查拼写。行动:检查任何自定义任务/类型 已被宣布。行动:检查任何 / 声明已经发生。

请推荐....

【问题讨论】:

    标签: ant build.xml


    【解决方案1】:

    您缺少 taskdef 标签,例如:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-14
      • 2013-03-09
      • 2023-03-14
      • 2011-12-19
      • 2016-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多