Install & Compatibility
Where this runs
tested against v2.16.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.084s · 33.7MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.4s · import 0.077s · 34MB
32MB installed
● package 32MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
allure
✓ import allure
The 'allure' object for decorators, attachments, and steps is typically imported directly. The underlying implementation comes from 'allure-python-commons' but is exposed via the 'allure-pytest' plugin.
scenario
✓ from pytest_bdd import scenario
BDD scenarios are defined using 'pytest_bdd' components.
This example demonstrates a basic `pytest-bdd` scenario integrated with `allure-pytest-bdd`. It includes a feature file and a test file with step definitions. The `allure.step` and `allure.attach` calls show how to enhance the report. Running `pytest` with `--alluredir` generates the report data, which can then be served locally using the Allure commandline tool.
# features/example.feature
# Feature: Basic BDD scenario
#
# Scenario: User logs in successfully
# Given a user is on the login page
# When the user enters valid credentials
# Then the user should be redirected to the dashboard
# test_example.py
import pytest
import allure
from pytest_bdd import scenario, given, when, then
@scenario('features/example.feature', 'User logs in successfully')
def test_login():
"""This is the test for the login scenario."""
pass
@given('a user is on the login page')
def login_page():
allure.step("Navigated to login page")
assert True
@when('the user enters valid credentials')
def enter_credentials():
with allure.step("Entering username and password"):
allure.attach("username: test_user", name="credentials", attachment_type=allure.attachment_type.TEXT)
assert True
@then('the user should be redirected to the dashboard')
def dashboard_redirect():
allure.dynamic.tag("login-flow")
assert True
# To run tests and generate Allure report:
# pytest --alluredir=allure-results
# To open the report in your browser (requires Allure commandline):
# allure serve allure-results
Debug
Known issues
gotchaViewing Allure reports requires the separate Allure commandline tool to be installed and run after tests. Generating test results with `--alluredir` only produces raw data files.fixInstall `allure-commandline` (e.g., `npm install -g allure-commandline`) and run `allure serve allure-results` after `pytest --alluredir=allure-results`.
affects: All versions
breakingPrior to version 2.14.0, the `allure-pytest-bdd` integration had limited support for the full Allure API (e.g., dynamic titles, attachments within steps, xfail).fixUpgrade to `allure-pytest-bdd>=2.14.0` to fully leverage the Allure API and ensure all features are supported, including expected failures (xfail), dynamic titles, gherkin tags conversion, and descriptions from feature/scenario metadata.
affects: <2.14.0
gotchaIn `allure-pytest-bdd` versions before 2.14.3, built-in pytest markers might have been incorrectly converted to Allure tags, leading to unintended tags in reports.fixUpgrade to `allure-pytest-bdd>=2.14.3` to ensure that only user-defined markers and Gherkin tags are converted to Allure tags, avoiding conflicts with reserved pytest markers.
affects: <2.14.3
gotchaWhen using pytest version 8.4 or later with `allure-pytest-bdd` prior to 2.14.3, attempting to change a fixture's title could result in errors.fixUpdate `allure-pytest-bdd` to version `2.14.3` or newer to resolve issues with fixture titling in newer `pytest` versions.
affects: <2.14.3 with pytest>=8.4
Errors
Common errors & fixes
pytest: error: unrecognized arguments: --alluredir=allure-results
The `allure-pytest` plugin is not installed or not properly registered with pytest.
fixEnsure `allure-pytest-bdd` (which depends on `allure-pytest`) is installed: `pip install allure-pytest-bdd`.
ModuleNotFoundError: No module named 'pytest_bdd'
The `pytest-bdd` library is not installed, which is a core dependency for `allure-pytest-bdd`.
fixInstall `pytest-bdd`: `pip install pytest-bdd` (or `pip install allure-pytest-bdd` which includes it).
No results found. Wiping out allure-results folder
The `allure serve` command was run, but the specified results directory (`allure-results` by default) either doesn't exist or contains no valid Allure report data.
fixFirst, run your tests with `pytest --alluredir=allure-results` to generate the report data. Then, ensure you are running `allure serve` from the same directory where `allure-results` was created, or specify the correct path.
pytest_bdd.exceptions.NoScenarioFound: No scenario 'Scenario: User logs in successfully' in features/example.feature
The scenario name or feature file path in the `@scenario` decorator does not exactly match the Gherkin feature file.
fixVerify that the scenario name and feature file path provided in `@scenario('features/example.feature', 'Scenario: User logs in successfully')` precisely match the content and location of your `.feature` file. Upgrade
Version history
2.16.0latest on PyPI · released Apr 27, 2026
Audit
Dependencies
allure-pytestrequiredCore Allure integration with pytest.
pytest-bddrequiredRequired for defining BDD scenarios.
pytestrequiredTest framework orchestrator.