I have a simple problem - I want to run a single Cucumber scenario, but I can't seem to find any option/configuration for that.
I have 5-6 scenarios and I can set up configurations to run all tests, but It takes too much time, when I am correcting one scenario...
Tag the feature file with any name, you may add multiple tags separated with spaces.
Eg :
@acceptance
@regression
Now, add below options in the end of VM otions by editing configuration
Run the test and it will only trigger the feature files tagged with
@acceptance
You can either set the configuration one for acceptance and one for regression or edit the configuration everytime you run it.
you can call single Scenario by calling it line number simply assuming your Scenario starts on line
-16 Scenario: description
Given: etc
you can run it like this
cucumber features\test.feature:16
You can specify a scenario as a run argument, either though Intellij or at the command line:
As jhilan mentions - In Ruby the command looks like this:
In cucumber-jvm, it looks like this:
E.g
-Dcucumber.options="classpath:com/company/my_feature.feature:6"
To set this up in Intellij, take a look at their docs on the subject of run configurations
I know this is an old post but it's still the second highest Google result when search "executing cucumber by scenario". So I thought it deserved a more thorough answer.