首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用testng.xml

如何使用testng.xml
EN

Stack Overflow用户
提问于 2011-04-27 21:14:37
回答 1查看 1K关注 0票数 0

嗨,我刚接触selenium,现在我想使用selenium rc和eclipse Ide来运行我的测试套件,我在执行时使用了ant,因为那时我在testNG.xml中遇到了错误。所以请告诉我如何使用testng.xml,并给我一个testng.xml示例

这是我的Build.xml

代码语言:javascript
复制
<property name="lib.dir"   value="/softwares/lib"/>
<property name="src.dir" value="/softwares/src" />
代码语言:javascript
复制
<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

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

我们收到以下错误:

代码语言:javascript
复制
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

请帮助me.....we遇到“在类路径中找不到类”的错误

EN

回答 1

Stack Overflow用户

发布于 2011-04-28 10:05:20

确保启动TestNG的类路径包含您的类。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5804703

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档