2011-04-27 41 views
0

嗨,我是新來的硒,現在我想運行我的測試套件使用硒rc和eclipse Ide 我有使用螞蟻時,我執行,那時我在testNG.xml中出現錯誤。所以請你告訴我任何一個如何使用的testng.xml,給我的testng.xml如何使用testng.xml

一個樣本這是我在build.xml

<property name="lib.dir" value="/softwares/lib"/> 
<property name="src.dir" value="/softwares/src" /> 

<target name="run_testNG" description="Run TestNG"> 
    <testng classpathref="compile.classpath" haltOnfailure="false"> 
     <xmlfileset dir="/softwares/cruisecontrol-bin-2.8.3/run_test/" includes="testng.xml" /> 
    </testng> 
</target> 
<target name="start-server"> 
    <java jar="/softwares/selenium/selenium-server-standalone-2.0b2.jar" fork="true" spawn="true"> 
     <arg line="-timeout 30"/> 
     <jvmarg value="-Dhttp.proxyHost=proxy.corporate.com"/> 
     <jvmarg value="-Dhttp.proxyPort=3128"/> 
    </java> 
</target> 
<target name="stop-server"> 
    <get taskname="selenium-shutdown" 
     src="http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer" 
     dest="result.txt" ignoreerrors="true" /> 
    <echo taskname="selenium-shutdown" message="DGF Errors during shutdown are expected" /> 
</target> 
<taskdef resource="testngtasks" classpath="/softwares/selenium/selenium-2.0b2/libs/testng-5.14.1.jar" /> 

======================= ====

這是我的testng.xml

===================

我們正在以下錯誤:

Buildfile: build.xml 
prepare: 
compile: 
run_test: 
    [waitfor] Wait for proxy server launch 
start-server: 
run_testNG: 
    [testng] [TestNG] [ERROR] 
    [testng] Cannot find class in classpath: com.example.tests 
    [testng] The tests failed. 
stop-server: 
[selenium-shutdown] Getting: http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer 
[selenium-shutdown] To: /softwares/cruisecontrol-bin-2.8.3/run_test/result.txt 
[selenium-shutdown] DGF Errors during shutdown are expected 
BUILD SUCCESSFUL 

請幫我.....我們得到錯誤「在類路徑中找不到類」

回答

0

確保您啓動TestNG的類路徑包含您的類。

相關問題