A modern, readable, CI/CD-friendly Markdown report formatter for Behave.
Project description
Behave Markdown Report
A modern, readable, CI/CD-friendly Markdown report formatter for the Behave BDD framework.
It generates a single report.md that you can publish directly to GitHub, GitHub Actions Summaries, GitLab, Azure DevOps, Jenkins, Bitbucket, wikis, or any Markdown viewer.
See a generated example report at examples/report.md.
Table of Contents
- Why Markdown?
- Features
- Installation
- Quick start
- Configuration
- Attachments
- Examples
- Report layout
- Architecture
- Documentation
- Development
- Changelog
- License
Why Markdown?
- Works everywhere — no JavaScript, no external assets, no HTML sanitization issues.
- CI-native — GitHub Actions, GitLab, and Azure DevOps render Markdown summaries out of the box.
- Diff-friendly — line-based changes make PR reviews easier.
- Portable — one file, easy to archive, email, or paste into an issue.
Features
- Single-file Markdown output with a table of contents and internal links.
- Executive summary showing passed, failed, and skipped counts with status icons.
- Feature summary table with links and durations.
- Tag statistics table with pass rate per tag.
- Failed scenarios section with error messages and tracebacks.
- Slowest scenarios top-10 list.
- Scenario details with collapsible sections, Gherkin backgrounds, data tables, and doc strings.
- Environment section with Python, Behave, OS, Git, and CI environment details.
- Attachments rendered inline: images, JSON, XML, HTML, logs, and plain text.
- No heavy dependencies — only the Python standard library and
behave.
Installation
Install from PyPI:
pip install behave-modern-md-report
Or install from source:
git clone https://github.com/MathiasPaulenko/behave-modern-md-report.git
cd behave-modern-md-report
pip install -e .
For development, install with the extra dependencies:
pip install -e ".[dev]"
Quick start
- Create or update
behave.iniin your Behave project root:
[behave]
format = markdown
outfiles = report.md
[behave.formatters]
markdown = behave_modern_md_report.formatter:BehaveMarkdownFormatter
- Run Behave:
behave
- Open
report.mdin any Markdown viewer.
If you prefer not to register the short name, use the full formatter path:
behave -f behave_modern_md_report.formatter:BehaveMarkdownFormatter -o report.md
Configuration
All options are passed through Behave's userdata mechanism. Add a [behave.userdata] section to behave.ini:
[behave.userdata]
bmr.title = My Report
bmr.project_name = My Project
bmr.company = My Company
bmr.include_passed = true
bmr.include_skipped = true
bmr.include_traceback = true
bmr.include_environment = true
bmr.sort_failed_first = true
bmr.max_traceback_lines = 0
You can also override options from the command line:
behave -D bmr.title="Nightly Report" -D bmr.include_environment=false
See docs/configuration.md for the full reference and troubleshooting.
Attachments
Capture screenshots, logs, JSON, or files directly from your features/environment.py hooks:
from behave_modern_md_report import attach_screenshot, log
def after_step(context, step):
if step.status == "failed":
log(context, f"URL at failure: {getattr(context, 'url', 'unknown')}")
attach_screenshot(context, getattr(context, "driver", None), name="failure.png")
See docs/attachments.md for the full attachment API and supported MIME types.
Examples
The repository includes two examples:
examples/behave_project/— a complete Behave project that exercises all report sections.examples/demo_generator/— a script that generates a syntheticdemo-report.mdwithout running Behave.
Run the example project:
cd examples/behave_project
behave
Generate the demo report:
python examples/demo_generator/generate_demo.py
Report layout
A generated report contains the following sections in order:
# My Report
## Table of Contents
## Executive Summary
## Statistics
## Feature Summary
## Tags
## Failed Scenarios
## Slowest Scenarios
## Scenario Details
## Environment
Each section is linked from the table of contents. Scenario details are wrapped in collapsible <details> blocks so the report stays readable even for large suites.
Architecture
Behave Markdown Report uses a clean, layered architecture:
| Layer | File | Responsibility |
|---|---|---|
| Formatter | formatter.py |
Adapts Behave events to the collector. |
| Collector | collector.py |
Builds the Execution model from Behave objects. |
| Models | models.py |
Pure dataclasses representing the test tree. |
| Statistics | statistics.py |
Computes aggregates and derived metrics. |
| Renderer | renderer.py |
Turns the Execution model into Markdown. |
| Markdown | markdown.py |
Low-level Markdown document helpers. |
| Attach API | attach.py |
Convenience helpers for environment.py. |
See docs/architecture.md for the full architecture and data flow.
Documentation
- docs/configuration.md — all
bmr.*options and troubleshooting. - docs/attachments.md — attaching screenshots, JSON, files, and logs.
- docs/ci-cd.md — GitHub Actions, GitLab CI, Azure DevOps, and Jenkins examples.
- docs/customizing.md — subclassing the renderer and building custom themes.
- docs/architecture.md — project structure and data flow.
Development
Install the development dependencies:
pip install -e ".[dev]"
Run the test suite:
pytest
Run the linter:
ruff check behave_modern_md_report tests
Run the type checker:
mypy behave_modern_md_report
Build the package:
python -m build
Changelog
See CHANGELOG.md for the release history.
License
This project is licensed under the MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file behave_modern_md_report-1.0.0.tar.gz.
File metadata
- Download URL: behave_modern_md_report-1.0.0.tar.gz
- Upload date:
- Size: 22.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09e882953ef27b176718aa13676c356fd588075030508f0f744c5fa632249caf
|
|
| MD5 |
dde029f101d970e651ec8841324fa0f1
|
|
| BLAKE2b-256 |
1176203418a6deda553e1693d7b06d1e9e247cd86c2e25591ba7e63f518df22e
|
Provenance
The following attestation bundles were made for behave_modern_md_report-1.0.0.tar.gz:
Publisher:
release.yml on MathiasPaulenko/behave-modern-md-report
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
behave_modern_md_report-1.0.0.tar.gz -
Subject digest:
09e882953ef27b176718aa13676c356fd588075030508f0f744c5fa632249caf - Sigstore transparency entry: 2005980923
- Sigstore integration time:
-
Permalink:
MathiasPaulenko/behave-modern-md-report@e619f3c7c2615ec28f96bfcaef2b98409c7ce208 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MathiasPaulenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e619f3c7c2615ec28f96bfcaef2b98409c7ce208 -
Trigger Event:
push
-
Statement type:
File details
Details for the file behave_modern_md_report-1.0.0-py3-none-any.whl.
File metadata
- Download URL: behave_modern_md_report-1.0.0-py3-none-any.whl
- Upload date:
- Size: 27.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
015747a8e66cd914224b55a25989b8827e77f62d3b6910e76fc044003e5a7ac5
|
|
| MD5 |
fb06e2748a9c15cbd79eb3987aa20561
|
|
| BLAKE2b-256 |
5c810b5a8ea74f1cb9ce778a2f25293da9604b51b0ae88816d6342c7caa61a7a
|
Provenance
The following attestation bundles were made for behave_modern_md_report-1.0.0-py3-none-any.whl:
Publisher:
release.yml on MathiasPaulenko/behave-modern-md-report
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
behave_modern_md_report-1.0.0-py3-none-any.whl -
Subject digest:
015747a8e66cd914224b55a25989b8827e77f62d3b6910e76fc044003e5a7ac5 - Sigstore transparency entry: 2005981073
- Sigstore integration time:
-
Permalink:
MathiasPaulenko/behave-modern-md-report@e619f3c7c2615ec28f96bfcaef2b98409c7ce208 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MathiasPaulenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e619f3c7c2615ec28f96bfcaef2b98409c7ce208 -
Trigger Event:
push
-
Statement type: