关于黄瓜硒的并行执行问题

问题描述 投票:0回答:1

我想问一下,按照下面的文档,使用分叉或不使用分叉的并行方法,哪种方法更好?

https:/maven.apache.orgsurefiremaven-surefire-pluginexamplesfork-options-and-parallel-execution.html。

在性能提升和更好地利用现有系统资源方面,使用哪些参数最好?

谢谢,Ranjana

selenium cucumber cucumber-java cucumber-spring
1个回答
0
投票

我相信你必须选择TestNG Runner来运行cucumber脚本。请看下面的示例代码。如果需要黄瓜选项,请在注释中添加这些选项。

import org.testng.annotations.DataProvider;
import io.cucumber.testng.AbstractTestNGCucumberTests;

    public class RunCucumberTest extends AbstractTestNGCucumberTests{

        @Override
        @DataProvider(parallel = true)
        public Object[][] scenarios() {
            return super.scenarios();
        }
    }

然后你可以在POM.xml中添加以下配置。

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.22.0</version>
        <executions>
            <execution>
                <goals>
                    <goal>integration-test</goal>
                    <goal>verify</goal>
                </goals>
              <configuration>
                 <parallel>classes</parallel>
                 <threadCount>4</threadCount>
              </configuration>
            </execution>
        </executions>
    </plugin>
© www.soinside.com 2019 - 2024. All rights reserved.