【问题标题】:Running test suite with dependencies in testng with selenium使用 selenium 在 testng 中运行具有依赖项的测试套件
【发布时间】:2015-02-02 08:32:55
【问题描述】:

嗨,我有多个类,它们有不同的 wep 应用程序 url 来执行测试。当我在单个测试套件下定义所有类时,testng 不会按照 testng.xml 文件中的定义运行测试。例如

<suite name="Auto Test" preserve-order="true" parallel="instances"
thread-count="10">

<listeners>
    <listener class-name="com.automation.core.listeners.CustomReporter" />
    <listener class-name="org.uncommons.reportng.HTMLReporter" />
    <listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
</listeners>

<test name="test1" preserve-order="true">
    <groups>
        <run>
            <include name="functest" />
            <exclude name="inprogress" />
        </run>
    </groups>
    <classes>
        <class name="com.test1" />
    </classes>
</test>

<test name="test2" preserve-order="true">
    <groups>
        <run>
            <include name="functest" />
            <exclude name="inprogress" />
        </run>
    </groups>
    <classes>
        <class name="com.test2" />
    </classes>
</test>
</suite>

现在当我运行 maven pom 文件时,系统首先运行 test2 而不是 test1。我们可以定义对测试的依赖吗?我是新手,找不到解决这个问题的方法?我正在使用带有 testng、selenium 和 java 的 maven。非常感谢您的帮助

谢谢,

【问题讨论】:

  • 你在 eclipse 中有什么插件版本,你的依赖项中的 testng jar 版本是什么?
  • 感谢您的回复-这是详细信息 eclipse helios = Build id: 20110218-0911 testng jar = 6.8 - in dependencies m2e = 1.4.1 testng in eclipse =6.8.6
  • 和你在 pom 中的万无一失的插件版本?
  • 它是 maven-surefire-plugin 2.6
  • preserve-order 默认为真。当我尝试它时,我没有看到这种行为。您可以尝试将您的万能插件版本更改为最新的 -2.18 我想吗

标签: java xml maven selenium testng


【解决方案1】:

只是为了结束这个问题,在套件标签中将并行更改为 false,更新了surefire插件。测试中存在导致上述问题的代码问题。

【讨论】:

    猜你喜欢
    • 2017-05-28
    • 2019-11-07
    • 1970-01-01
    • 2017-12-31
    • 2018-05-10
    • 1970-01-01
    • 2011-12-24
    • 2021-04-18
    • 1970-01-01
    相关资源
    最近更新 更多