Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ant 如何使用TestNG并行执行多个套件_Ant_Testng - Fatal编程技术网

Ant 如何使用TestNG并行执行多个套件

Ant 如何使用TestNG并行执行多个套件,ant,testng,Ant,Testng,我可以按顺序执行上述套件,但我想并行执行这些套件 please find the xml <suite name="Main suite" > <!--commenting parallel="suite-file" thread-count="2"--> <suite-files> <suite-file path="suite1.xml" /> <suite-file path="suite2.xm

我可以按顺序执行上述套件,但我想并行执行这些套件

please find the xml 
 <suite name="Main suite"  > <!--commenting parallel="suite-file" thread-count="2"-->
    <suite-files>
        <suite-file path="suite1.xml" />
     <suite-file path="suite2.xml" />
      </suite-files>
    </suite>
请查找xml

请参考此处的TestNG文档:

对于并行运行的套件:

java org.testng.TestNG -suitethreadpoolsize 2 suite1.xml suite2.xml 
为了运行测试/类/方法/实例,请在testng xml中定义它

<suite name="Main suite" parallel="methods/classes/tests/instances" thread-count="5">

我有一个类似问题的答案,可能对您有所帮助。使用套件XML配置,您走上了正确的道路


我已经有一段时间没有使用这种类型的配置了,但我在回答中提到的是如何使它并行工作。可能存在其他方法,但希望这能让您开始。

您应该将代码放在问题下,而不是作为注释。2个问题:#1如果对于
java org.testng.testng-suitethreadpoolsize 10 suite1.xml suite2.xml
,会发生什么?套件线程池大小为10,但套件文件仅为2#2套件>suitethreadpoolsize中的
线程计数是否可以?@AayushKumarSingha for#1您正在分配10个线程,但只使用了2个。TestNG根据待执行的挂起套件/测试/方法处理要创建的线程数。这种情况在正常情况下也会出现。假设您有10个方法要执行,线程池大小为3,假设所有测试同时结束,您将有1个方法挂起。然后TestNG将关闭另外两个线程,并只在一个线程上运行。在用尽所有方法后,线程将被关闭。@Aayuskumarsingha对于#2问题,我还没有尝试过这种配置。我猜TestNG在SuiteThreadPools*线程计数中运行,并创建了那么多线程。我通常不走这条路,而是创造多个詹金斯工作岗位。如果您尝试了配置并从中获得了一些经验,请在这里告诉我。