Automation 我无法用Cucumber并行执行控制多线程
我已成功配置Cucumber并行执行,但默认情况下,一次将创建10个线程。因此,我使用-Ddataproviderthreadcount=2尝试了maven命令,它成功了。但当我尝试在POM文件中定义此选项时,它不起作用 我的POM:Automation 我无法用Cucumber并行执行控制多线程,automation,parallel-processing,cucumber,testng,maven-failsafe-plugin,Automation,Parallel Processing,Cucumber,Testng,Maven Failsafe Plugin,我已成功配置Cucumber并行执行,但默认情况下,一次将创建10个线程。因此,我使用-Ddataproviderthreadcount=2尝试了maven命令,它成功了。但当我尝试在POM文件中定义此选项时,它不起作用 我的POM: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> &l
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<parallel>both</parallel>
<threadCount>2</threadCount>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<properties>
<property>
<name>dataproviderthreadcount</name>
<value>2</value>
</property>
</properties>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/${test.suite}.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</execution>
</executions>
我的TestNG:
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="Suite1" verbose="1">
<listeners>
<listener class-name="Utilities.Listener"></listener>
</listeners>
<test name="Test" >
<classes>
<class name="TestRunners.runnerOne" />
</classes>
</test>
</suite>
为了充分利用Cucumber的TestNG,您应该尝试使用纯TestNG实现。它将每个场景视为TestNG测试,并将场景大纲和示例视为数据驱动测试。因此,它支持不同的并行配置和参数,如线程数、数据提供程序线程数等 在您的情况下,您正在使用cucumber,因此要支持cucumber中的步骤实现,您将需要。用于支持以
Gherkin
格式或BDD2
格式编写的功能文件,后者是Gherkin的超集
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="Suite1" verbose="1">
<listeners>
<listener class-name="Utilities.Listener"></listener>
</listeners>
<test name="Test" >
<classes>
<class name="TestRunners.runnerOne" />
</classes>
</test>
</suite>