pytest-bdd
BDD for pytest
Decision gist · record as of 2026-08-14
Yes. pytest-bdd is actively maintained, permissively licensed, has no known vulnerabilities, and integrates cleanly into pytest workflows. Install it if you need BDD-style testing, want to document requirements as executable scenarios, or need to bridge technical and non-technical stakeholders. The low install friction and mature codebase make it a safe choice for projects already using pytest.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; feature files must follow Gherkin syntax and be discoverable by pytest.
- Low install friction with a pure-Python wheel and seven runtime dependencies.
- The package is actively maintained with recent releases, 1460 repository stars, and support for modern Python versions (3.9–3.13).
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely in both open-source and commercial projects with minimal restrictions.
last release 2024-12-05 (617 days) · last repo commit 2026-08-10 · 1,460 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,611,297 downloads/mo, #2,558 on PyPI
Alternatives
Verify before relying
pip install pytest-bdd
from pytest_bdd import scenario, given, when, then
@scenario('example.feature', 'Example scenario')
def test_example():
pass
@given('a precondition')
def precondition():
return True- Whether the package's Gherkin subset covers the full range of Gherkin constructs needed for your project.
- Performance characteristics when running large numbers of scenarios or with complex step definitions.
- Integration compatibility with other pytest plugins beyond those listed as runtime dependencies.
What it is and what it does
pytest-bdd is a pytest plugin that brings Gherkin-style behavior-driven development (BDD) testing into the pytest ecosystem. It lets you write human-readable feature files describing application behavior, then map those steps to Python test functions using decorators. Unlike standalone BDD tools, it integrates directly with pytest, so you can reuse pytest fixtures, combine BDD and unit tests in the same project, and avoid maintaining a separate test runner.
The package supports step parameters with multiple parser types (string, parse, cfparse, regex), step aliases for readability, and dependency injection through pytest fixtures. It handles the full BDD workflow—Given/When/Then steps, scenario outlines, and step argument parsing—while letting you leverage pytest's reporting, plugins, and configuration.
Use it for
- Write acceptance tests in plain Gherkin that non-technical stakeholders can read and understand.
- Unify functional and unit tests in a single pytest suite, reducing test infrastructure complexity.
- Reuse existing pytest fixtures as setup and action steps in BDD scenarios via dependency injection.
- Parameterize BDD steps with multiple data types using parse or cfparse parsers for scenario coverage.
- Maintain feature documentation that stays synchronized with executable tests.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
pytest-bdd is actively maintained, permissively licensed, has no known vulnerabilities, and integrates cleanly into pytest workflows. Install it if you need BDD-style testing, want to document requirements as executable scenarios, or need to bridge technical and non-technical stakeholders. The low install friction and mature codebase make it a safe choice for projects already using pytest.
Install
pytest-bdd on PyPI
Before you install
Low install friction with a pure-Python wheel and seven runtime dependencies. The package is actively maintained with recent releases, 1460 repository stars, and support for modern Python versions (3.9–3.13).
Requires Python 3.9 or later; feature files must follow Gherkin syntax and be discoverable by pytest.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in both open-source and commercial projects with minimal restrictions.
Quickstart
pip install pytest-bdd
from pytest_bdd import scenario, given, when, then
@scenario('example.feature', 'Example scenario')
def test_example():
pass
@given('a precondition')
def precondition():
return True
Verify before relying
- Whether the package's Gherkin subset covers the full range of Gherkin constructs needed for your project.
- Performance characteristics when running large numbers of scenarios or with complex step definitions.
- Integration compatibility with other pytest plugins beyond those listed as runtime dependencies.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 7 packagesMakogherkin-officialpackagingparseparse-typepytesttyping-extensions |
| Maintenance | Actively maintained 617 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,611,297 / month, #2,558 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 6 - MatureIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Software Development :: TestingTopic :: Utilities |
Evidence: pytest_bdd-8.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “Gherkin pytest plugin”
- pytest-bddpytest-bdd implements Gherkin-based behavior-driven development…
- qase-pytestA pytest plugin that reports test results to Qase TestOps, linking…
- gherkin-officialParses and compiles Gherkin feature files into abstract syntax trees…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also behave · radish-bdd · vedro · terraform-compliance · behave-django · gherkin-official · cucumber-expressions · cucumber-tag-expressions · allure-pytest-bdd · behavex