在classpath中找不到类:packagename.classname

时间:2015-02-13 12:25:01

标签: java eclipse ant testng

我正在使用ant和testng

这是我的 testng.xml

<suite name="StudioVox Behavioural Tests" verbose="3" parallel="classes" 
    thread-count="4">
    <test name="StudioVoxLifeCycle">
        <classes>
            <class name="studio.Studiovox" />
        </classes>
    </test>
</suite>

Eclipse详细信息 面向Web开发人员的Eclipse Java EE IDE。 版本:开普勒服务版本1 建造ID:20130919-0819

java版本&#34; 1.7.0-ea&#34;

从cmd

运行时出现以下错误
run:
   [testng] [TestNG] [ERROR]
   [testng] Cannot find class in classpath: studio.Studiovox
   [testng] The tests failed.

的build.xml

<project  name="grok-web-automation" default="run" basedir=".">
    <property name="src" location="src" />
    <property name="build" location="build" />
    <property name = "lib.dir" value="${basedir}/lib" />
    <property name = "testng.output.dir" value="${basedir}/results" />

    <path id="classpath">
      <fileset dir="${lib.dir}" includes="**/*.jar" /> 
       <pathelement location="build" />
    </path>

   <!-- create build folder, testng_output folder and remove old log file -->
    <target name="init">
        <delete dir="build" />
        <delete dir="testng_output" />
        <delete file="Test_Auto.log" />
        <mkdir dir="${build}" />
    </target>
    <!-- build all java file to class binary -->
    <target name="compile" depends="init">
        <javac srcdir="${src}" destdir="${build}" classpathref="classpath" includeantruntime="false" />
    </target>

    <!-- execute testng after compile, then generate report -->
    <target name="run" depends="compile">
        <mkdir dir="testng.output.dir" />
        <taskdef name="testng" classname="org.testng.TestNGAntTask">
                    <classpath>
                        <pathelement location="./lib/testng-6.8.5.jar" />
                    </classpath>
        </taskdef>

        <!-- config testng -->
        <testng outputdir="testng.output.dir" classpathref="classpath">

            <sysproperty key="url" value="${url}" />
            <sysproperty key="os" value="${os}" />
            <sysproperty key="browser" value="${browser}" />
            <!-- execute testcase -->
            <xmlfileset dir="./SupportBuildXML" includes="testngstudio.xml" />
        </testng>
    </target>
</project>

0 个答案:

没有答案