Useful Cucumber.js features

There are some features in Cucumber.js that can be handy in certain situations. Let's see what they are.

Tagging features and scenarios

You can tag features, scenarios, and Examples: sections to selectively execute only tagged parts of your specification.

You can create a tag using the @ character as follows:

@ready
Feature: Some feature

  @simple
  Scenario: scenario 1
    # Skipped for brevity
  @errorcase
  Scenario: scenario 2
    # Skipped for brevity
  @important @regression
  Scenario Outline: scenario 3
    # Skipped for brevity

  Examples:
    | placeholder 1 | placeholder 2 |
    | example 1.1   | example 1.2   |
    | example 2.1   | example 2.2   |

 @complicated
    Examples:
    | placeholder 1 | placeholder 2 |
    | example 3     | example 2     |

You can simply put a space-separated ...

Get Learning Behavior-driven Development with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.