0

我的测试套件中有多个测试组(a、b、c 等)。如果我必须让一个组'z'在所有其他组的末尾运行(列表不固定并且可以增长),我该如何通过 testng.xml 来做到这一点?

TestNG 文档建议在 testng.xml 中使用以下内容:

<test name="My suite">
  <groups>
    <dependencies>
      <group name="z" depends-on="a  b  c" />
    </dependencies>
  </groups>
</test>

但在我的情况下,a,b,c 不是固定的。每次添加新组时,我都无法在 testng.xml 中明确列出数十个组。

这就是我当前的 testng.xml 的样子:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods" thread-count="5">
    <test name="App tests">
        <groups>
            <run>
                <exclude name="smoke"/>
                <exclude name="rest"/>
            </run>
        </groups>
        <packages>
            <package name="apps.webdriver.*"></package>
        </packages>
    </test>
</suite>

请让我知道是否有办法实现这一目标。

4

1 回答 1

0

我可以根据类/包来考虑“分组”测试。您的 z 组将在一个单独的类中,而 a、b、c....将在不同的类中。

于 2019-05-10T05:50:13.193 回答