【问题标题】:Stop running tests in xml suite if first test class fails如果第一个测试类失败,则停止在 xml 套件中运行测试
【发布时间】:2015-08-20 20:43:35
【问题描述】:

运行测试套件时,我希望仅在 test1 通过时执行测试 2-9,否则不运行。测试 1 确保满足测试 2-9 的先决条件。这是一个示例 xml 段:

<suite name="suite1">
<test name="test suite">
    <parameter name="selenium.browser" value="firefox" />
    <classes>
        <class name="test1" />
        <class name="test2" />
        <class name="test3" /> 
        <class name="test4" />
        <class name="test5" />
        <class name="test6" />
        <class name="test7" />
        <class name="test8" />
        <class name="test9" />
    </classes>
</test>

我正在使用带有 selenium webdriver 的 testng 来运行测试。我认为它与依赖标签有关,但我不确定它是如何工作的,因为我是 xml 的新手。我读过标签可以用来链接其他项目的依赖关系,但是标签中各个类之间的依赖关系呢?提前致谢!

【问题讨论】:

  • test1 是一种设置方法还是您正在测试其中的某些内容?

标签: xml selenium-webdriver testng build-automation


【解决方案1】:

您可以使用groupdependsOnGroups 功能:http://testng.org/doc/documentation-main.html#dependent-methods

在您的情况下,“test1”应该在一个组中,“test2-9”应该在另一个组中,依赖于第一个组。

【讨论】:

  • 我已经弄明白了,谢谢!这就是我所做的,所以赞成它
猜你喜欢
  • 2020-04-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多