vab2048
vab2048

Reputation: 1255

Using CLI to run feature files in parallel but scenarios within same thread?

I have read the documentation page on Parallel Execution and for the CLI the only option seems to be to use the --threads <COUNT> flag to increase parallelism. However, this will cause each scenario to be executed in parallel.

Is there a way I can indicate I want each feature to be executed in parallel but each scenario within that feature to be on the same thread (executed sequentially)?

I've seen it is possible to do that when using JUnit and Maven, but I am using JUnit and Gradle and that does not seem to be an option.

Upvotes: 0

Views: 410

Answers (1)

user1207289
user1207289

Reputation: 3253

I think you may want to look at Courgette-JVM

It is an extension of cucumber-jvm and it can be run with gradle. It supports junit and testng and parallel testing using threads

You may have to alter your testrunner class and add @CourgetteOptions and include @CucumberOptions inside it like

import courgette.api.CourgetteRunLevel;
import courgette.api.testng.TestNGCourgette;
import cucumber.api.CucumberOptions;
import org.testng.annotations.Test;
@Test
@CourgetteOptions(
        threads = 2,
        runLevel = CourgetteRunLevel.FEATURE,
        rerunFailedScenarios = true,
        showTestOutput = true,
        reportTargetDir = "build",
        cucumberOptions = @CucumberOptions(
                features = "src/test/resources/features",
                glue = {"utils.hooks", "steps"},
                tags = {"@Web"},
                plugin = {
                        "pretty",
                        "json:build/cucumber-report/cucumber.json",
                        "html:build/cucumber-report/cucumber.html"},
                strict = true
        ))

public class TestRunner extends TestNGCourgette {

} 

If you would like to see Courgette-JVM in an example , have a look at this parallel test execution example using gradle

Upvotes: 1

Related Questions