Using tags to label, organize, and filter our Features
Tags provide an extremely useful way to denote different contexts for our Features. They can be used to group Feature
s together, indicate scope, filter Scenario
s, and provide visual clues to our readers. Tags are just words prefixed by the @
symbol. Let's take a look at the following Feature
(shortened for brevity):
@order Feature: Buyer places order @important Scenario: Missing delivery address Given … @wip @financial Scenario: Applying discount Given …
We have applied the @order
tag at the beginning of our Feature
. This means that the tag applies to all the Scenario
s within that Feature
. If we ask a BDD tool, such as Cucumber, to run everything tagged with @order
, it will execute both the Missing delivery address
and Applying discount
scenarios. We could apply the same tag to other Features
and Scenarios
too, if they were referring to order-related functionality.
We have applied...