简体   繁体   English

如何使用TestNG并行运行属于特定组的测试用例

[英]How to run test cases belonging to a particular group in parallel using TestNG

How to run test cases belonging to a particular group in parallel using TestNG. 如何使用TestNG并行运行属于特定组的测试用例。 For example, let say there is a group named "up" containing 10 test cases. 例如,假设有一个名为“ up”的组,其中包含10个测试用例。 I want to run all these test cases in parallel (threads=number of test cases). 我想并行运行所有这些测试用例(线程=测试用例数)。 How can I achieve in using TestNG. 如何使用TestNG实现。

Try the following testng.xml . 试试下面的testng.xml If you don't know the number of test cases before you run your code, just be sure that the threadCount is higher than it :) 如果在运行代码之前不知道测试用例的数量,只需确保threadCount大于它即可:)

  <suite parallel="methods" threadCount="10">    
    <test name="MyTest">
      <groups>
        <run>
          <include name="up"  />
        </run>
      </groups>

      <classes>
        <class name="test.TestClass" />
      </classes>
    </test>
  </suite>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM