I want to run my 5 Cucumber feature files with “Mvn test” Command parallely. Now, the “mvn test” or ‘mvn build” runs fine and maven builds the project, but feature file dont run. Can this be due to version mismatch? I am using JUnit 4, Cucumber 7.4.0 and Maven 6.9.3. Tried with lastest 7.18.0 Cucumber but nothing works. Also, I am using maven surefire plugin to run 5 feature files parallely, but nothing runs. NO feature file is running. Do in need to make multiple runners? I Just want parallel execution at feature levels, not scenario level. Please provide some assistance. I am stuck.
[INFO]
[INFO] — maven-surefire-plugin:3.3.0:test (default-test) @ SmokeTestAutomation —
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 22.154 s
[INFO] Finished at: 2024-06-23T17:36:09+05:30
[INFO] ————————————————————————
POM.xml:
<dependencies>
<!– https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core –>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.23.1</version>
</dependency>
<!– https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api –>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.23.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.3.1</version>
</dependency>
<!– https://mvnrepository.com/artifact/org.apache.poi/poi-examples –>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-examples</artifactId>
<version>5.1.0</version>
</dependency>
<!– https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml –>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.1.0</version>
</dependency>
<!– https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java –>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.13.0</version>
</dependency>
<!– https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-api –>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>4.13.0</version>
</dependency>
<!– https://mvnrepository.com/artifact/io.cucumber/cucumber-testng –>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.4.0</version>
</dependency>
<!– https://mvnrepository.com/artifact/io.cucumber/cucumber-core –>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>7.4.0</version>
</dependency>
<!– https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm –>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm</artifactId>
<version>7.4.0</version>
<type>pom</type>
</dependency>
<!– https://mvnrepository.com/artifact/io.cucumber/cucumber-junit –>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.4.0</version>
</dependency>
<!– https://mvnrepository.com/artifact/io.cucumber/cucumber-testng –>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>7.4.0</version>
</dependency>
<!– https://mvnrepository.com/artifact/org.testng/testng –>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>openxml4j</artifactId>
<version>1.0-beta</version>
</dependency>
<!– https://mvnrepository.com/artifact/commons-collections/commons-collections –>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>4.1</version>
</dependency>
<!– <dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.4.0</version>
</dependency> –>
<!– https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api –>
<!– https://mvnrepository.com/artifact/junit/junit –>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<!– https://mvnrepository.com/artifact/com.jcabi/jcabi-log –>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>tech.grasshopper</groupId>
<artifactId>extentreports-cucumber7-adapter</artifactId>
<version>1.14.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<includes>
<include>**/TestRunner.java</include>
</includes>
<parallel>methods</parallel>
<useUnlimitedThreads>true</useUnlimitedThreads>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<includes>
<include>**/TestRunner.java</include>
</includes>
<parallel>methods</parallel>
<useUnlimitedThreads>true</useUnlimitedThreads>
</configuration>
</plugin>
</plugins>
</build>
</project>
TestRUnner.Java
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(glue = { “stepDefinitions” }, features = { “src/test/resources/features” },
monochrome = false, tags = “@UserLevel and @AdminLevel”)
public class TestRunner {
}
Source: Read More