behave-html-formatter

raw JSON →
0.9.10 verified Mon Apr 27 auth: no python

HTML formatter for Behave (BDD test framework). Renders test results as a standalone HTML report. Current version 0.9.10, with infrequent releases. Compatible with Python >=3.6 and Behave.

pip install behave-html-formatter
error ImportError: cannot import name 'HTMLFormatter'
cause Using wrong import path: `from behave_contrib import HTMLFormatter` instead of `from behave_html_formatter import HTMLFormatter`.
fix
Use the correct import: from behave_html_formatter import HTMLFormatter
error ModuleNotFoundError: No module named 'behave_html_formatter'
cause The `behave-html-formatter` package is not installed.
fix
Run pip install behave-html-formatter
error behave: error: argument --format: invalid choice: 'html' (choose from 'json', 'plain', 'pretty', 'progress', 'rerun', 'steps', 'tags')
cause Behave does not have the built-in 'html' formatter; the behave-html-formatter package must be installed and registered.
fix
Install with pip install behave-html-formatter and ensure it's available in the environment. Then the 'html' format will appear.
gotcha The formatter only generates HTML output when the 'html' format is specified. If multiple formats are used, ensure you include 'html'.
fix Use `behave --format html --outfile report.html` or set in behave.ini: `format = pretty,html` if you want both console and HTML output.
gotcha The output file path specified in `--outfile` is relative to the current working directory, not the feature directory. In behave.ini, the path is also relative to the project root.
fix Always use absolute paths or ensure the relative path matches your project layout. Example: `behave --format html --outfile /absolute/path/report.html`
deprecated Version 0.9.10 fixed CSS issues, but older versions (<=0.9.7) had broken CSS and missing JavaScript minification which could corrupt the report.
fix Upgrade to >=0.9.9 to get proper CSS and JS handling.

Install the formatter, configure Behave to use it, then run tests.

pip install behave behave-html-formatter

# In your features/ directory, add or modify behave.ini:
[behave]
format = html
outfile = reports/report.html

# Then run behave:
behave