How To Run A Single Cucumber Scenario Or Feature
Cucumber
05/09/2022
To run a single Cucumber scenario or feature, one has to use tags. Tags are keywords prepended with an @
sign, which are inserted before a section heading.
GHERKIN
@authenticationFeature: Authenticate user
@login Scenario: User login ...
@logout Scenario: User logout ...
If a tag is assigned to a feature, every scenario in it will inherit the tag. In other words, running a feature tag will run all of its scenario. Running a tag can be achieved as follows:
BASH
$ npm run cucumber-js --tags @login
Running multiple features or scenarios
To run more than one feature or scenario, simply append your tags to the command.
BASH
$ npm run cucumber-js --tags @login @logout @anotherTag