Beautiful, glowing HTML test reports for PyTest and unittest.
Project description
pytest-glow-report ✨
Beautiful, glowing HTML test reports for PyTest and unittest
Stunning visuals • Zero configuration • Infinite customization
Features • Installation • Quick Start • Configuration • Customization
✨ Features
| Feature | Description |
|---|---|
| 🚀 Zero Config | Just install and run — reports generate automatically |
| 🎨 Stunning Design | Glassmorphism UI, animated backgrounds, dark/light mode |
| 📊 History Tracking | SQLite-backed test run history with trend charts |
| 🔍 Interactive Filtering | Click summary cards to filter Pass/Fail/Skip |
| Screenshot Support | Embed screenshots from Selenium, Playwright, or files |
| 📋 Step Tracking | Log individual test steps with timing |
| 🎯 Fully Customizable | Custom logo, title, environment info, and hooks |
📦 Installation
pip install pytest-glow-report
🚀 Quick Start
PyTest (Automatic)
Simply run your tests — reports generate automatically:
pytest
Report saved to: reports/report.html
Unittest
Use the CLI wrapper:
glow-report run -- unittest discover tests
⚙️ Configuration
Environment Variables
Configure the report using environment variables:
| Variable | Description | Default | Example |
|---|---|---|---|
GLOW_REPORT_TITLE |
Title shown in the report header | Glow Test Report |
My Project CI |
GLOW_TEST_TYPE |
Type of test run | — | Regression, Smoke, Sanity |
GLOW_BROWSER |
Browser under test | — | Chrome 120, Firefox 121 |
GLOW_DEVICE |
Device/platform under test | — | iPhone 15, Pixel 8, Web |
GLOW_ENVIRONMENT |
Target environment | — | Production, Staging, QA |
GLOW_BUILD |
Build/version number | — | v2.1.0, #12345 |
Usage Examples:
# Regression test on Chrome
export GLOW_REPORT_TITLE="E-Commerce Regression"
export GLOW_TEST_TYPE="Regression"
export GLOW_BROWSER="Chrome 120"
export GLOW_ENVIRONMENT="Staging"
pytest
# Mobile smoke test
export GLOW_TEST_TYPE="Smoke"
export GLOW_DEVICE="iPhone 15 Pro"
export GLOW_ENVIRONMENT="Production"
pytest tests/mobile/
# Windows PowerShell
$env:GLOW_TEST_TYPE="Smoke"
$env:GLOW_BROWSER="Edge 120"
$env:GLOW_DEVICE="Windows 11"
pytest
Command-Line Options
| Option | Description | Default |
|---|---|---|
--report-dir |
Directory to save reports | reports |
--glow-report / --no-glow-report |
Enable/disable report generation | Enabled |
Usage:
# Custom output directory
pytest --report-dir=my_reports/
# Disable report generation
pytest --no-glow-report
🎨 Customization
Custom Logo
Add a logo to your report by implementing the pytest_html_logo hook in your conftest.py:
# conftest.py
def pytest_html_logo():
"""Return a URL or base64-encoded image for the report logo."""
# Option 1: URL
return "https://your-company.com/logo.png"
# Option 2: Base64 (for offline reports)
# import base64
# with open("logo.png", "rb") as f:
# return f"data:image/png;base64,{base64.b64encode(f.read()).decode()}"
Custom Environment Info
Add custom metadata to the Environment section:
# conftest.py
import os
def pytest_html_environment():
"""Add custom key-value pairs to the Environment section."""
return {
"Browser": "Chrome 120",
"Environment": os.environ.get("ENV", "local"),
"Build": os.environ.get("CI_BUILD_ID", "dev"),
"Branch": os.environ.get("GIT_BRANCH", "main"),
}
Result: The Environment panel in your report will show:
| Key | Value |
|---|---|
| Python | 3.11.5 |
| Platform | linux |
| Browser | Chrome 120 |
| Environment | staging |
| Build | 12345 |
| Branch | main |
📸 Screenshots
Capture and embed screenshots in your tests:
from beautiful_report import report
def test_login_page(driver):
driver.get("https://example.com/login")
# Option 1: Capture from Selenium/Playwright driver
report.screenshot("login_page", driver=driver)
# Option 2: Use an existing file
report.screenshot("saved_screenshot", path="screenshots/login.png")
# Screenshots appear as thumbnails in the expanded test view
📋 Step Tracking
Log individual steps within your tests:
from beautiful_report import report
@report.step("Opening login page")
def open_login(driver):
driver.get("/login")
@report.step("Entering credentials")
def enter_credentials(driver, user, password):
driver.find_element("id", "username").send_keys(user)
driver.find_element("id", "password").send_keys(password)
@report.step("Clicking submit button")
def submit(driver):
driver.find_element("css selector", "button[type='submit']").click()
def test_login_flow(driver):
open_login(driver)
enter_credentials(driver, "admin", "secret123")
submit(driver)
assert "Dashboard" in driver.title
Result: The report shows numbered steps with:
- Step name
- Duration
- Pass/fail status
🎯 Interactive Features
Clickable Summary Cards
Click any summary card to filter results:
- Total Tests (teal gradient) → Shows all tests
- Passed (green) → Shows only passed tests
- Failed (red, pulsing) → Shows only failed tests
- Skipped (amber) → Shows only skipped tests
Dark Mode
Toggle with the sun/moon button in the header. Your preference is saved in local storage.
Expandable Test Details
Click any test to expand and see:
- Error tracebacks (with copy button)
- Captured stdout/stderr
- Test steps with timing
- Embedded screenshots
📁 Output Structure
reports/
├── report.html # Interactive HTML report
├── report.json # Machine-readable JSON results
└── history.sqlite # Test run history database
🔧 API Reference
report.step(title)
Decorator to mark a function as a test step.
@report.step("Doing something important")
def my_function():
pass
report.screenshot(name, driver=None, path=None)
Capture or attach a screenshot.
| Parameter | Type | Description |
|---|---|---|
name |
str | Name for the screenshot |
driver |
WebDriver | Selenium/Playwright driver (optional) |
path |
str | Path to existing image file (optional) |
report.log(message)
Add a custom log message.
report.log("User created successfully")
🤝 Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines.
📄 License
MIT License - see LICENSE for details.
Made with ❤️ for the testing community
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 pytest_glow_report-0.1.0.tar.gz.
File metadata
- Download URL: pytest_glow_report-0.1.0.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b770db07a88582fce7c4e33c4538a4e914e84a2da036ecd83045c3df98eff7c
|
|
| MD5 |
f151f01023ee5b86c050d59adc7d8747
|
|
| BLAKE2b-256 |
184c39bd94fa84c74f78ef3baaafae2ae71726cb0edbcc05c0ef3c94fcadd539
|
File details
Details for the file pytest_glow_report-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pytest_glow_report-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f041a501edfd5d8b3c2bc7d6dcb01cffa43cd531fd4a3d20cd07a39af1cc9a79
|
|
| MD5 |
c658064cfdda8578f2ac55cb8dff2141
|
|
| BLAKE2b-256 |
6dd1e9c7052b8743c1f42688211edcef94c5b520e3d2b97e64cfec33cc269e93
|