'How to convert my cucumber project to run in parallell?

Hi I currently have a large project where i run my cucumber tests, I am running these at night but im finding the jenkins build keeps breaking after an hour or so, so I want to now run my tests in parallel.

Is this possible to do with an existing project, my project is set up with the feature files, steps,runner etc in the src/test/java directory enter image description here

and my test runner looks like this

import io.cucumber.junit.CucumberOptions;
import io.cucumber.junit.Cucumber;
import org.junit.runner.RunWith;
import org.testng.annotations.DataProvider;

@RunWith(Cucumber.class)
@CucumberOptions(
    features = {"src/test/java/noting/feature_files/"},
    glue = {"noting.steps", "noting.hooks"},
    tags = {"@regression"},
    monochrome = true,
    plugin = {"pretty", "json:target/cucumber-report/cucumber.json", "rerun:target/rerun.txt"}
)

public class MainRunner {



}

Is there a way to convert this to run in parallel, maybe by annotation or feature package?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source