Skip to main content

pytest-glow-report ✨

Python PyTest License

Beautiful, glowing HTML test reports for PyTest and unittest

Stunning visuals • Zero configuration • Infinite customization

FeaturesInstallationQuick StartConfigurationCustomization


✨ 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

Download files

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

Source Distribution

pytest_glow_report-0.1.1.tar.gz (30.7 kB view details)

Uploaded Source

Built Distribution

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

pytest_glow_report-0.1.1-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file pytest_glow_report-0.1.1.tar.gz.

File metadata

  • Download URL: pytest_glow_report-0.1.1.tar.gz
  • Upload date:
  • Size: 30.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pytest_glow_report-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5db53848e92caed5723f711613ca2acb1665714a48148d89baabe7e5a9923710
MD5 b292f572b94a5fe3ae6049bf7c086ecc
BLAKE2b-256 4e90e0c8c5234871549ab64826d7862e002e908a9b1a69669286934ba2b7d218

See more details on using hashes here.

File details

Details for the file pytest_glow_report-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_glow_report-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 40ab4f691fabfef233255c01bab69b79c72dfb8fc9d8658c2436b6575ca14c30
MD5 20335d538f8791f886d96029ee755f74
BLAKE2b-256 09bb72f1cad1da26f75cbc705843a8d85403ba48bdf528136b696d4821dc1b46

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.2

2 files

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

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