How to run a single cucumber script in Intellij?

I have a simple problem - I want to run one Cucumber script, but I cannot find any option / configuration for this.

I have 5-6 scenarios and I can configure the configurations to run all the tests, but it takes too much time when I fix one scenario ...

+12
source share
4 answers

Mark the function file with any name, you can add several tags separated by spaces.

For example: @acceptance @regression

Now add below options at the end of the VM by editing the configuration

 -Dcucumber.options="--tags @acceptance" 

Run the test and it will only run files with @acceptance tags

You can either set the configuration for acceptance, or one for regression, or edit the configuration every time you run it.

+11
source

You can specify the script as an argument to run, although Intellij or on the command line:

As jhilan mentions, in Ruby the command looks like this:

 cucumber path/to/file.feature:33 

In cucumber-jvm, it looks like this:

 -Dcucumber.options="classpath:<package-path>/<file>.feature:<line>" 

For example, -Dcucumber.options="classpath:com/company/my_feature.feature:6"

To install this in Intellij, check out their docs on launch configuration

I know this is an old post, but it is still Google’s second largest search result for “scripted cucumber execution”. So I thought I deserved a more thorough answer.

+1
source

you can call one script just by calling it line number if your script starts on line

-16 Scenario: description
Given: etc

you can run it as follows

features of cucumber \ test.feature: 16

0
source

Right-click the script line in your object file, there will be the option "Script: my script".

At least IntelliJ 2019

0
source

Source: https://habr.com/ru/post/969501/


All Articles