tags

Tags are a great way to organise your features and scenarios. Consider this example:

@billing
Feature: Verify billing

  @important
  Scenario: Missing product description

  Scenario: Several products

A Scenario or feature can have as many tags as you like. Just separate them with spaces:

@billing @bicker @annoy
Feature: Verify billing

Tag Inheritance

Any tag that exists on a Feature will be inherited by Scenario, Scenario Outline or Examples.

Running a subset of scenarios

You can use the --tags option to tell Cucumber that you only want to run features or scenarios that have (or don’t have) certain tags. Examples:

cucumber --tags @billing            # Runs both scenarios
cucumber --tags @important          # Runs the first scenario
cucumber --tags ~@important         # Runs the second scenario (Scenarios without @important)

cucumber --tags @billing --tags @important    # Runs the first scenario (Scenarios with @important AND @billing)
cucumber --tags @billing,@important           # Runs both scenarios (Scenarios with @important OR @billing)

(Another way to “filter” what you want to run is to use the file.feature:line pattern or the --scenario option as described in Running Features).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s