pytest-automation-report
pytest-automation-report is a lightweight pytest plugin that creates a self-contained HTML execution report after a test run. It works with plain pytest suites as well as UI suites built on Selenium or Playwright. The report includes:
- summary cards for key test metrics
- outcome distribution charts
- execution phase timing charts
- slowest test visualizations
- module-level execution breakdown
- embedded failure screenshots
- failure details and a complete test result table
Preview
Dashboard summary
Failure details with screenshots
Installation
pip install -e .
Usage
Generate a report on demand:
pytest --automation-report=reports/automation-report.html
Customize the report title:
pytest \
--automation-report=reports/automation-report.html \
--automation-report-title="Nightly Regression Dashboard"
Customize both title and subtitle:
pytest \
--automation-report=reports/automation-report.html \
--automation-report-title="Nightly Regression Dashboard" \
--automation-report-subtitle="UI + API smoke and regression insights"
You can also configure a default output path in pytest.ini:
[pytest]
automation_report = reports/automation-report.html
automation_report_title = CI Automation Report
automation_report_subtitle = Self-contained pytest execution report with runtime metrics, outcome analytics, and detailed failure visibility.
What the Report Includes
- KPI summary cards for total tests, pass rate, total runtime, and average runtime
- a donut chart showing overall test outcomes
- a bar chart for total phase durations across setup, call, and teardown
- a bar chart for the slowest tests in the run
- a bar chart highlighting the busiest test modules
- embedded screenshots for failed UI tests
- failure cards with stack traces
- a detailed test results table
Example Integration
Once installed, the plugin is discovered automatically by pytest through the pytest11 entry point. That means your existing test suite can use it without changing test code.
If you prefer local plugin loading during development, you can also enable it explicitly:
# conftest.py
pytest_plugins = ["pytest_automation_report.plugin"]
UI Screenshot Support
The plugin supports screenshots in two ways:
- automatic capture on test failure from supported Selenium and Playwright fixtures
- manual screenshot attachment from the test itself through the
automation_reportfixture
Automatic failure screenshots
Selenium WebDriver fixtures named driver, browser, selenium, or webdriver are detected automatically when they expose get_screenshot_as_base64() or get_screenshot_as_png().
If your test already uses a Selenium fixture called driver, no extra code is required beyond generating the report:
def test_checkout(driver):
driver.get("https://example.com/checkout")
assert "Success" in driver.page_source
When that test fails during the call phase, the plugin will try to capture a screenshot and embed it directly in the HTML report.
Playwright sync fixtures named page, playwright_page, context, or browser_context are also supported. For context fixtures, the plugin captures the most recently opened page.
def test_checkout(page):
page.goto("https://example.com/checkout")
assert page.get_by_text("Success").is_visible()
When that test fails during the call phase, the plugin will call page.screenshot(type="png") and embed the image into the report.
Manual screenshot attachment
Use the built-in automation_report fixture when you want explicit control over what gets attached:
def test_checkout(driver, automation_report):
driver.get("https://example.com/checkout")
if "Success" not in driver.page_source:
automation_report(
image_base64=driver.get_screenshot_as_base64(),
name="Checkout failure state",
)
assert "Success" in driver.page_source
You can also attach raw bytes:
automation_report(image_bytes=driver.get_screenshot_as_png(), name="Current page")
The same manual helper works with Playwright:
def test_checkout(page, automation_report):
page.goto("https://example.com/checkout")
automation_report(image_bytes=page.screenshot(type="png"), name="Checkout state")
assert page.get_by_text("Success").is_visible()
Helper import option
If you prefer not to use the fixture, you can also call the helper directly:
from pytest_automation_report.plugin import attach_screenshot
def test_checkout(driver, request):
attach_screenshot(
request,
image_base64=driver.get_screenshot_as_base64(),
name="Checkout failure state",
)
Release files for pytest-html-report-builder 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_html_report_builder-0.1.8.tar.gz | 20.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_html_report_builder-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.4 kB
Release files / pytest_html_report_builder-0.1.8.tar.gz
| Download URL | pytest_html_report_builder-0.1.8.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb215e0b76afad35b1ac93a51e800cc1f92e1b574ec4a1e1622f8a5388be9587
|
|
BLAKE2b-256 checksum How to use checksums |
d1d46b1bcfb298427ec4ef38fe2c608d84c3a0ee12e04334d3c2ea3166d60732
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 22, 2026.
Transparency logRelease files / pytest_html_report_builder-0.1.8-py3-none-any.whl
| Download URL | pytest_html_report_builder-0.1.8-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f255e274408a20ad206cf5f2948a4b53633c9ac67bd2ec2d8cbb18b1ca14c1df
|
|
BLAKE2b-256 checksum How to use checksums |
21d8008cda5be01d0dff9bf2ce0fe7629c2bb25e89044ba9692deec0c09b917e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 22, 2026.
Transparency log