【问题标题】:How to run my testng classes one after the other如何一个接一个地运行我的测试类
【发布时间】:2017-12-06 02:37:37
【问题描述】:

我正在运行一个自动化测试,其中一个包中有两个类。下面是我的 testng.xml 文件

    <?xml version="1.0" encoding="UTF-8"?>
<suite name="AutomationFramework">
    <test name="RegressionTesting">
        <classes>
            <class name="first_Test.testng"/>
            <class name="first_Test.TestNG2"/>
        </classes>
    </test>
</suite>

我的第一个类(testng)使用 Chrome 运行,而第二个类(TestNG2)使用 Firefox 运行。当我运行我的 testng.xml 文件时,我看到两个浏览器同时打开并同时执行它们的测试用例。

如何优先考虑我的第一堂课在 chrome 中运行,然后在完成后,第二堂课运行。

谢谢!

【问题讨论】:

  • 可以分享一下启动浏览器的代码吗?默认情况下,Testng 中的并行设置为 none,因此 Testng 不会并行启动您的测试。

标签: selenium-webdriver automation testng


【解决方案1】:

在套件标签中,添加两个属性parallel="none",并将线程数限制为1。标签应该看起来像

<suite name="AutomationFramework" parallel="false" thread-count="1">

这应该禁用并发执行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-28
    • 2022-01-11
    • 2017-10-17
    相关资源
    最近更新 更多