I am new to cucumber testing framework. My goal is to run scenario files in parallel using Junit and Maven. I have followed the following steps : https://cucumber.io/docs/guides/parallel-execution/
I have two feature files
Feature 1 :
Feature: Scenarios feature file One
Scenario: Scenario Number One
When request is sent to fetch data with user one
Then check the result
Feature 2 :
Feature: Scenarios feature file One
Scenario: Scenario Number Two
When request is sent to fetch data with user two
Then check the result
I also have a runner file as follow :
@RunWith(Cucumber.class)
@CucumberOptions(features = { "classpath:features" },
strict = true,
glue = {"integration.cucumber.step"},
plugin = {"pretty", "html:target/report/cucumber", "json:target/report/cucumber/cucumber.json"},
tags = {"not @Disabled"}
)
public class CucumberTests {
}
My POM is as follows :
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<parallel>methods</parallel>
<useUnlimitedThreads>true</useUnlimitedThreads>
</configuration>
</plugin>
</plugins>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<version>4.12</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>4.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>4.4.0</version>
<scope>test</scope>
</dependency>
When I run cucumber tests by mvn clean install, both the Scenarios run with different threads. But I run using runner file created (CucumberTests) both the run with same thread. How do I make them run with different threads using runner class ?