Skip to main content

Cucumber logo
Cucumber Tag Expressions

Readable boolean expressions to select features and scenarios marked with tags in Gherkin

npm build backers sponsors build

# -- SIMPLE TAG-EXPRESSION EXAMPLES:
@a and @b
@a or @b
not @a

# -- MORE TAG-EXPRESSION EXAMPLES:
@a and not @b
(@a or @b) and not @c

Getting Started

Cucumber Tag Expressions is available as cucumber-tag-expressions on PyPI.

pip install cucumber-tag-expressions

Parse tag expressions and evaluate them against a set of tags.

>>> from cucumber_tag_expressions import parse

# Tagged with @fast
>>> fast = parse("@fast")
>>> fast({"@fast", "@wip"})
True
>>> fast({"@performance", "@slow"})
False

# Tagged with @wip and not @slow
>>> wip_not_slow = parse("@wip and not @slow")
>>> wip_not_slow({"@wip", "@home"})
True
>>> wip_not_slow({"wet", "warm", "raining"})
False

# Tagged with both `@fast` and `@integration`
>>> fast_integration = parse("@integration and @fast")
>>> fast_integration({"@integration", "@fast", "@other"})
True
>>> fast_integration({"@system", "@fast"})
False

# Tagged with either @login or @registration
>>> auth_pages = parse("@login or @registration")
>>> auth_pages({"@account", "@login"})
True
>>> auth_pages({"@admin", "@account"})
False

Test Runner Usage

A gherkin test runner (such as behave) uses tag expressions to select scenarios to run.

# -- TAG-EXPRESSION: @one and @two
# EXPECTED: Selects and runs scenario "Three".
$ my_cucumber_test_runner --tags="@one and @two" features/example.feature
...

# -- TAG-EXPRESSION: @one or @two
# EXPECTED: Selects and runs scenarios "One", "Two" and "Three".
$ my_cucumber_test_runner --tags="@one or @two" features/example.feature
...

Such as using the following feature file.

# -- FILE: features/example.feature
Feature: Tag expressions example

  @one
  Scenario: One
    Given a step passes

  @two
  Scenario: Two
    Given another step passes

  @one @two
  Scenario: Three
    Given some step passes

  Scenario: Four
    Given another step passes

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cucumber_tag_expressions-11.0.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cucumber_tag_expressions-11.0.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file cucumber_tag_expressions-11.0.1.tar.gz.

File metadata

  • Download URL: cucumber_tag_expressions-11.0.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cucumber_tag_expressions-11.0.1.tar.gz
Algorithm Hash digest
SHA256 f8304dd16e546517816e62ace6c486575023812f42e8a60526fcec1694016146
MD5 0a0afed49e399817d48a55ab657229f3
BLAKE2b-256 50e0c2741558040293465d615a4f2555e9180c54a559119b96ff0251dda5fa90

See more details on using hashes here.

File details

Details for the file cucumber_tag_expressions-11.0.1-py3-none-any.whl.

File metadata

  • Download URL: cucumber_tag_expressions-11.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cucumber_tag_expressions-11.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ee5433a3b1ad16ca607c905fa3bb6d85d57f087ba119b14ea5e82cd35ea98c5
MD5 d9072aa0fb27951654500cc2951625c8
BLAKE2b-256 f82a894aded5804c76cf148965721cb57fed0d923ddb2747a77c9147f20d58a9

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

11.0.1 This release

2 files

11.0.0

2 files

10.0.0

2 files

9.1.0

2 files

9.0.0

2 files

8.1.0

2 files

8.0.0

2 files

7.0.0

2 files

6.2.0

2 files

6.1.2

2 files

6.1.1

2 files

6.1.0

2 files

6.0.0

2 files

5.0.6

2 files

5.0.5

2 files

5.0.4

2 files

5.0.3

2 files

5.0.2

2 files

5.0.1

2 files

5.0.0

2 files

4.1.0

1 file

4.0.2

1 file

4.0.0

1 file

3.0.1

1 file

3.0.0

1 file

2.0.4

1 file

2.0.3

1 file

1.1.2

2 files

1.1.1

2 files

1.0.2

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page