Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

junit - Maven Won't run Cucumber tests in parallel

I am trying to run my Cucumber tests in parallel after following a tutorial but in my debug it keeps returning that the MavenParallelExecution = false

My pom.xml file for the plugin is as follows

<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>

My debug log returns:

[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 

And my Runner class is as follows:


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 {

}

Am I doing something wrong here? I changed it to be exactly the same as the tutorial at this point but it's still broken

Thanks for any help

question from:https://stackoverflow.com/questions/66068321/maven-wont-run-cucumber-tests-in-parallel

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...