简体   繁体   中英

BDD Cucumber Maven Junit Parralel execution not working

I have 3 feature files each features contains of 3 tests so in total 9 tests but only 3 tests are executing and its picking up on;y 1st feature file.I have given global tag @smoke in all feature files Please find the pom file below. io.github.bonigarcia webdrivermanager 4.0.0 org.seleniumhq.selenium selenium-java 3.141.59
junit junit 4.13 test org.hamcrest hamcrest-all 1.3 test info.cukes cucumber-java 1.2.5 info.cukes cucumber-junit 1.2.5 info.cukes cucumber-jvm-deps 1.0.5 provided net.masterthought cucumber-reporting 5.0.2

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>gherkin</artifactId>
    <version>2.12.2</version>
    <scope>provided</scope>
</dependency>
  </dependencies>
  <build>
    <pluginManagement>
      <plugins>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M4</version>
          <configuration>
          <parallel>methods</parallel>
       <useUnlimitedThreads>true</useUnlimitedThreads>
        </configuration>
        </plugin>   
      </plugins>
    </pluginManagement>
  </build>

There are several options to incorporate parallel execution feature in a Cucumber project, like:

  1. JUnit
  2. TestNG
  3. CLI

but in the execution there are some differences. one of the differences is how they read the feature files and set separate threads to run the scenarios. JUnit (which you have used) uses one thread per feature file not per scenario or other parts in the files.

if you want all scenarios to run at once, write them in different feature files or use TestNG instead of JUnit .

more info on: https://cucumber.io/docs/guides/parallel-execution/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM