Maven 不会并行运行 Cucumber 测试

时间:2021-02-05 18:02:07

标签: junit cucumber maven-failsafe-plugin

我在完成教程后尝试并行运行我的 Cucumber 测试,但在我的调试中它不断返回 MavenParallelExecution = false

我的插件pom.xml文件如下

<plugin> 
            <groupId>org.apache.maven.plugins</groupId> 
            <artifactId>maven-failsafe-plugin</artifactId> 
            <version>3.0.0-M5</version>
            <executions> 
                <execution> 
                    <goals> 
                        <goal>integration-test</goal> 
                    </goals> 
                    
                    <configuration> 
                        <!--UNCOMMENT - To add any exclusions if required--> 
                        <!--<excludes> <exclude>**/*IT*.java</exclude> </excludes>--> 
                    
                        <includes>
                     
                            <!-- UNCOMMENT BELOW LINE - To execute feature files with a single runner -->
                            <include>**/MyTestRunner.java</include> 
                            <!-- UNCOMMENT BELOW LINE - To execute feature files with multiple runners-->
                            <!--<include>**/*MyTestRunner.java</include> -->
                        </includes> 
                        <!-- UNCOMMENT BELOW 3 LINES - To execute using parallel or combination option -->
                        <parallel>both</parallel> 
                        <threadCount>4</threadCount> 
                        <!--  <perCoreThreadCount>true</perCoreThreadCount> -->
                        <!-- UNCOMMENT BELOW 3 LINES - To execute using forking or combination option-->
                        <!-- <forkCount>2</forkCount><reuseForks>true</reuseForks><reportsDirectory>${project.build.directory}/failsafe-reports_${surefire.forkNumber}</reportsDirectory>--> 
                    </configuration>
                </execution> 
            </executions>

我的调试日志返回:

[DEBUG]   (f) excludedEnvironmentVariables = []
[DEBUG]   (f) forkCount = 1
[DEBUG]   (s) forkMode = once
[DEBUG]   (s) forkedProcessExitTimeoutInSeconds = 30
[DEBUG]   (s) includes = [**/MyTestRunner.java]
[DEBUG]   (s) junitArtifactName = junit:junit
[DEBUG]   (s) parallel = both
[DEBUG]   (f) parallelMavenExecution = false
[DEBUG]   (s) parallelOptimized = true
[DEBUG]   (s) perCoreThreadCount = true 

我的Runner类如下:


import org.junit.runner.RunWith;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions(
        features = {"src/test/resources/AppFeatures"},
        glue = {"stepdefinitions", "AppHooks"},
        monochrome = true,
        plugin = {"pretty",
                "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"
        }
        
        )

public class MyTestRunner {

}

我在这里做错了吗?我现在把它改成和教程一模一样,但还是坏了

感谢您的帮助

0 个答案:

没有答案