2

i am using maven-surefire, cucumber and testng to run a few cucumber test in parallel, I would like to execute a few test in parallel and a few in serial order. PS- i am not using testng.xml but using testrunner.java to run my test.

Regards

  • Please see the annotation **@NotThreadSafe** and the documentation https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html There is exactly this problem solved. It goes with JUnit 4 - not TestNG and JUnit5. – tibor17 Jun 24 '20 at 17:25

2 Answers2

1

You can set-up parallel in your pom.xml. Need add configuration with thread count and parallel (methods, class, etc.)

Example:

</plugins>
    [...]
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M5</version>
        <configuration>
          <parallel>methods</parallel>
          <threadCount>10</threadCount>
        </configuration>
      </plugin>
    [...]
</plugins>
Amerousful
  • 2,292
  • 1
  • 12
  • 26
  • With this all my tests are running in parallel, I want to run a few serially also. Feature file does not support @notthreadsafe annotations so need a different way to avoid using a feature file in parallel mode. – Aditya Gupta Jun 21 '20 at 10:49
  • my problem is i have not used Test tag, i have tags mentioned in my .feature file, not sure how to create a Test tag dependency in feature file – Aditya Gupta Jun 21 '20 at 19:24
  • The linked issue only involves tags from feature files. – M.P. Korstanje Jun 22 '20 at 08:42
  • Aditya, i wrote that @NotThreadSafe works with JUnit 4. The Cucumber also works with JUnit4. Can you migrate your tests from TestNG to JUnit? – tibor17 Jun 26 '20 at 18:42
1

Please see the annotation @NotThreadSafe and the documentation https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html There is exactly this problem solved. It goes with JUnit 4 - not TestNG and JUnit5.

tibor17
  • 1,043
  • 6
  • 9