Tag Expressions¶
Tag-Expressions v2¶
cucumber-tag-expressions are now supported and supersedes the old-style tag-expressions (which are deprecating). cucumber-tag-expressions are much more readable and flexible to select tags on command-line.
# -- SIMPLE TAG-EXPRESSION EXAMPLES:
@a and @b
@a or @b
not @a
# -- MORE TAG-EXPRESSION EXAMPLES:
# HINT: Boolean expressions can be grouped with parenthesis.
@a and not @b
(@a or @b) and not @c
Example:
# -- SELECT-BY-TAG-EXPRESSION (with tag-expressions v2):
# Select all features / scenarios with both "@foo" and "@bar" tags.
$ behave --tags="@foo and @bar" features/
Tag Matching with Tag-Expressions¶
The new tag-expressions also support partial string/tag matching with wildcards.
# -- FILE: features/one.feature
Feature: Alice
@foo.one
Scenario: Alice.1
...
@foo.two
Scenario: Alice.2
...
@bar
Scenario: Alice.3
...
The following command-line will select all features / scenarios with tags that start with “@foo.”:
$ behave -f plain --tags="@foo.*" features/one.feature
Feature: Alice
Scenario: Alice.1
...
Scenario: Alice.2
...
# -- HINT: Only Alice.1 and Alice.2 are matched (not: Alice.3).
Hint
- Filename matching wildcards are supported.
See
fnmatch
(Unix style filename matching). - The tag matching functionality is an extension to cucumber-tag-expressions.