Search code examples
javamavenseleniumcucumber-jvm

Parallel Execution - Cucumber-JVM v4.0.0


I'm struggling to get the new parallel execution feature of Cucumber-JVM v4.0.0 working.

As discussed here, an argument can be made via CLI to invoke the multi-threading options.

However when i run the below, the request is accepted and the tests are run, but still only one test at a time.

mvn clean test -Dcucumber.options="--threads 4" -Dbrowser=chrome

I'm either over estimating the out of the box functionality or, and more likely, missing some other key configuration or just completely misunderstanding.

Has anyone had any luck in getting this working?

EDIT: Sorry i forgot to mention, it does state that dependency injection has to be used to share state between steps in order for parallel execution to work. Just to confirm, i'm using Pico Container to manage dependency injection.


Solution

  • You cannot use this functionality with Maven. With Maven u need to use the 'parallel' options in junit or testng etc. Refer to the links for them in the same article.

    This option is for running the feature files directly from the command line using the cucumber.api.cli.Main class. Refer to this - https://github.com/cucumber/cucumber-jvm/blob/v4.0.0/core/src/main/resources/cucumber/api/cli/USAGE.txt