首页 > 解决方案 > 在不同线程中运行多个同步和异步测试套件

问题描述

在我的 testng 中,我有多个测试套件。例如

<suite name="Suite">
   <suite-files>
      <suite-file path="ASynchronousTestfile1.xml"/>
      <suite-file path="SynchronousTestfile2.xml"/>
      <suite-file path="SynchronousTestfile3.xml"/>
   </suite-files>
</suite>

现在,在单独的 testng 线程上运行套件。我正在使用surefire插件配置在单独的线程上运行它。像这样的东西:

<configuration>
   <suiteXmlFiles>testng.xml</suiteXmlFiles>
   <skipTests>false</skipTests>
   <properties>
      <property>
         <name>suitethreadpoolsize</name>
         <value>3</value>
      </property>
   </properties>
</configuration>

现在因为我的 ASynchronousTestFile1.xml 有非依赖的测试用例,我希望这个测试套件在多个线程上运行。因此,我通过以下方式在套件本身上提供了测试级并行性:

<test name="All Asynchronous Tests" parallel="methods" thread-count="7">

所以我的看法是总共有 9 个线程,其中 2 个将定义为 2 个同步套件,7 个线程用于异步测试套件。

我在哪里失踪或实现这种情况的正确方法是什么?

标签: multithreadingparallel-processingtestngmaven-surefire-plugintestng.xml

解决方案


推荐阅读