Maven/Junit Parallel Execution - Cucumber-JVM v4.0.0

筅森魡賤 提交于 2019-12-06 05:23:59
at org.apache.maven.surefire.common.junit48.FilterFactory$GroupMatcherCategoryFilter.shouldRun(FilterFactory.java:207)

You are using JUnit 4.12. However as noted above the stack trace tells us that surefire is trying to use an integration for JUnit 4.8. Your version of surefire was released in 2012, where as JUnit 4.12 was released in 2014. Have you considered updating your maven surefire plugin?

I managed to get it to work by explicitly adding the dependency of the testing framework:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.22.2</version>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven.surefire</groupId>
      <artifactId>surefire-junit47</artifactId>
      <version>2.22.2</version>
    </dependency>
  </dependencies>
  <configuration>
    <parallel>all</parallel>
    <threadCount>4</threadCount>
  </configuration>
</plugin>

Leaving it here as it might help somebody else

In my case

  • maven was not picking up Junit 5 tests
  • cucumber tests were not running in parallel

Got it working by

  • adding junit-jupiter 5.5.2
  • adding maven-surefire-plugin 2.22.2 and explicitly adding surefire-junit47 2.22.2

            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.2</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.surefire</groupId>
                    <artifactId>surefire-junit47</artifactId>
                    <version>2.22.2</version>
                </dependency>
            </dependencies>
            <configuration>
                <parallel>both</parallel>
                <threadCount>4</threadCount>
            </configuration>
        </plugin>
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!