Skip to main content

Static analysis and diagnostics for Behave BDD suites.

Project description

behave-doctor

Static analysis and diagnostics for Behave BDD suites.

CI Coverage Python License PyPI

behave-doctor inspects your Behave .feature files and Python step definitions without executing them, surfacing issues like unused step definitions, undefined steps, oversized features, inconsistent tags, and circular import dependencies.

Features

  • 18 diagnostic rules across 5 categories (structure, quality, coverage, complexity, dependencies).
  • 3 output formats: human-readable text, JSON, and SARIF 2.1.0 for GitHub Code Scanning.
  • Zero runtime dependencies beyond behave-model — pure Python, fully typed, mypy --strict clean.
  • Configurable via [tool.behave-doctor] in pyproject.toml.
  • Python API for embedding in custom tooling.

Quick start

pip install behave-doctor
behave-doctor scan .
Scanning . ...
Found 12 features, 47 scenarios, 213 steps, 89 step definitions.

BD301  WARNING   Unused step definition: "the user clicks submit"  (features/steps/auth.py:42)
BD302  ERROR      Undefined step: "Given the database is seeded"   (features/login.feature:18)

1 errors, 1 warnings in 0.42s

Rules

ID Name Severity Category
BD101 feature-count info Structure
BD102 scenario-count info Structure
BD103 step-count info Structure
BD104 tag-coverage info Structure
BD201 duplicate-step-defs error Quality
BD202 scenario-no-tags warning Quality
BD203 feature-too-many-scenarios warning Quality
BD204 inconsistent-tag-casing warning Quality
BD301 unused-step-def warning Coverage
BD302 undefined-step error Coverage
BD303 unused-tag info Coverage
BD304 orphan-scenario warning Coverage
BD401 scenario-too-many-steps warning Complexity
BD402 step-too-many-params warning Complexity
BD403 feature-too-large warning Complexity
BD501 circular-dependency error Dependency
BD502 unused-import warning Dependency
BD503 missing-step-module error Dependency

Configuration

# pyproject.toml
[tool.behave-doctor]
features_dir = "features"
steps_dir = "features/steps"
min_severity = "hint"
exclude_tags = ["@smoke", "@wip"]

[tool.behave-doctor.rules.BD203]
max_scenarios = 15

[tool.behave-doctor.rules.BD401]
max_steps = 8

Python API

from behave_doctor import scan_project

report = scan_project("path/to/project")
for d in report.diagnostics:
    print(f"{d.rule_id}: {d.message} at {d.file}:{d.line}")
print(f"Exit code: {report.exit_code}")

CI/CD

- run: pip install behave-doctor
- run: behave-doctor scan . --format sarif -o behave-doctor.sarif
- uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: behave-doctor.sarif

Documentation

Full documentation at https://mathiaspaulenko.github.io/behave-doctor/.

License

MIT

Project details


Download files

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

Source Distribution

behave_doctor-1.0.0.tar.gz (47.2 kB view details)

Uploaded Source

Built Distribution

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

behave_doctor-1.0.0-py3-none-any.whl (37.2 kB view details)

Uploaded Python 3

File details

Details for the file behave_doctor-1.0.0.tar.gz.

File metadata

  • Download URL: behave_doctor-1.0.0.tar.gz
  • Upload date:
  • Size: 47.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for behave_doctor-1.0.0.tar.gz
Algorithm Hash digest
SHA256 08a95a0a647e41bf263fdaa8bc0515d0913e72cf201897a3468b127ad188f955
MD5 8b62e8c008c9a00f7cbfddd12af9ab60
BLAKE2b-256 d8ea1721391b3dd69a1a2cb8496dfc3ac5b3340510d377606bd256e569022724

See more details on using hashes here.

Provenance

The following attestation bundles were made for behave_doctor-1.0.0.tar.gz:

Publisher: release.yml on MathiasPaulenko/behave-doctor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file behave_doctor-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: behave_doctor-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 37.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for behave_doctor-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67c8740c910f0d0b3058b7daae68bd71aa966752345d2ab47dd987660acc245d
MD5 641c46dd154e78d590df42cb8eff85be
BLAKE2b-256 9f1de43d39abeefe4a77e0079827eb4173a0ccde7d8e49e64d0aed52af5eba9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for behave_doctor-1.0.0-py3-none-any.whl:

Publisher: release.yml on MathiasPaulenko/behave-doctor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page