如何使用testng.xml

发布于 2024-11-03 08:24:19 字数 2398 浏览 1 评论 0原文

您好,我是 selenium 新手,现在我想使用 selenium rc 和 eclipse Ide 运行我的测试套件 我在执行时使用了 ant,当时我在 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

请帮助我......我们收到错误“无法在类路径中找到类”

Hi i am new to selenium, now i want to run my test suite using selenium rc and eclipse Ide
i have using ant when i execute, for that time i got error in testNG.xml. so kindly tell me any one how to use testng.xml and give me one sample of testng.xml

This is my 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" />

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

This is my testng.xml

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

We are getting following errors:

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

Please help me.....we are getting error for "Cannot find class in classpath"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风渺 2024-11-10 08:24:19

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

Make sure the classpath you launch TestNG with contains your classes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文