Skip to main content

Beautiful dashboard-style HTML reports for pytest with charts, error analysis, and visual insights

Project description

pytest-html-dashboard

PyPI version Python versions License: MIT

Transform your pytest HTML reports into beautiful, interactive dashboards!

A comprehensive pytest plugin that enhances HTML reports with interactive charts, intelligent error classification, and modern styling.

โœจ Features

๐ŸŽฏ Interactive Charts - Visualize test results with Chart.js powered donut and pie charts ๐ŸŽจ Modern UI - Beautiful gradient styling with responsive design ๐Ÿ” Smart Error Analysis - Automatic error classification with suggested fixes ๐Ÿ“Š Comprehensive Tables - Detailed test information with expandable error details ๐Ÿ”ง Highly Configurable - YAML, CLI, or programmatic configuration โšก Zero Config - Works out of the box with sensible defaults ๐Ÿ“ฑ Mobile Responsive - Looks great on all devices ๐ŸŽญ Custom Branding - Add your logo, colors, and company name

๐Ÿ“ธ Sample Report

View Sample Report (Download and open in browser)

The enhanced report includes:

  • Test Status Distribution - Visual breakdown of passed/failed/skipped tests
  • Pass Rate Charts - Overall test success metrics
  • Error Analysis - Categorized failures with remediation suggestions
  • Comprehensive Test Table - Filterable, sortable results with error details
  • Step Execution Summary - Detailed test step information

๐Ÿš€ Quick Start

Installation

pip install pytest-html-dashboard

Basic Usage

pytest --html=report.html --self-contained-html

That's it! The plugin automatically enhances your HTML report with all features enabled.

๐Ÿ“– Configuration

YAML Configuration

Create pytest_html_dashboard.yaml:

branding:
  company_name: "My Company"
  report_title: "Test Execution Dashboard"
  logo_url: "path/to/logo.png"  # Or base64 encoded
  primary_color: "#667eea"
  secondary_color: "#764ba2"

charts:
  enable_charts: true
  chart_height: 300
  chart_animation: true

report:
  enable_enhanced_reporting: true
  enable_error_classification: true
  show_timestamps: true

Command Line Options

pytest --html=report.html \
       --dashboard-company-name="My Company" \
       --dashboard-report-title="Test Dashboard" \
       --dashboard-primary-color="#667eea"

Programmatic Configuration

# conftest.py
from pytest_html_dashboard import ReporterConfig, BrandingConfig

def pytest_configure(config):
    branding = BrandingConfig(
        company_name="My Company",
        report_title="Custom Dashboard",
        primary_color="#667eea"
    )

    reporter_config = ReporterConfig(branding=branding)
    config._dashboard_config = reporter_config

๐Ÿ“Š Configuration Options

Branding

Option Default Description
company_name "Test Automation Framework" Your company/project name
report_title "Test Execution Dashboard" Report header title
logo_url None Logo image (URL or base64)
primary_color "#004488" Primary theme color
secondary_color "#0066CC" Secondary theme color
success_color "#4CAF50" Success indicator color
failure_color "#f44336" Failure indicator color

Charts

Option Default Description
enable_charts true Enable/disable charts
chart_height 300 Chart height in pixels
chart_animation true Animated chart transitions
show_pass_rate_chart true Display pass rate visualization
show_status_distribution_chart true Display status breakdown

Report Features

Option Default Description
enable_enhanced_reporting true Enable all enhanced features
enable_error_classification true Categorize and analyze errors
enable_comprehensive_table true Show detailed test table
max_error_message_length 100 Truncate long error messages
show_timestamps true Display test execution times
show_duration true Show test durations

๐ŸŽฏ CI/CD Integration

GitHub Actions

- name: Run tests
  run: pytest --html=report.html --self-contained-html

- name: Upload report
  uses: actions/upload-artifact@v3
  with:
    name: test-report
    path: report.html

Jenkins

pipeline {
    stages {
        stage('Test') {
            steps {
                sh 'pytest --html=report.html --self-contained-html'
            }
        }
    }
    post {
        always {
            publishHTML([
                reportDir: '.',
                reportFiles: 'report.html',
                reportName: 'Test Dashboard'
            ])
        }
    }
}

GitLab CI

test:
  script:
    - pytest --html=report.html --self-contained-html
  artifacts:
    when: always
    paths:
      - report.html
    expire_in: 30 days

๐Ÿ“ฆ Examples

The repository contains:

  • tests/test_dashboard_features.py - Comprehensive test suite demonstrating all features
  • config/sample_config.yaml - Sample configuration file
  • reports/complete_dashboard_report.html - Sample generated report
  • examples/ - Additional examples and demos

Run the tests:

pytest tests/test_dashboard_features.py --html=reports/report.html --self-contained-html

๐Ÿ” What's Enhanced?

Interactive Features

  • โœ… Click column headers to sort table data
  • โœ… Filter tests by status (passed/failed/skipped)
  • โœ… Filter by error category
  • โœ… Search tests by name
  • โœ… Click "View Error" buttons for detailed error information
  • โœ… Hover over charts for detailed statistics

Visual Enhancements

  • โœ… Modern gradient backgrounds
  • โœ… Animated charts with data labels
  • โœ… Color-coded test status indicators
  • โœ… Responsive layout for mobile devices
  • โœ… Professional typography and spacing
  • โœ… Sticky table headers for easy navigation

Error Intelligence

Automatically categorizes errors into:

  • ๐Ÿ”ด Assertion Failures - Test logic issues
  • โฑ๏ธ Timeout Errors - Performance problems
  • ๐Ÿ”Œ Connection Errors - Network/API issues
  • โš™๏ธ Configuration Errors - Setup problems
  • ๐Ÿ“ฆ Import Errors - Dependency issues
  • ๐Ÿ› Runtime Errors - Execution failures

Each error includes:

  • Error type and message
  • Full stack trace
  • Suggested remediation steps
  • Context and timestamp

๐Ÿ†š Comparison with pytest-html

Feature pytest-html pytest-html-dashboard
Basic HTML reports โœ… โœ…
Interactive charts โŒ โœ…
Error classification โŒ โœ…
Custom branding Limited โœ… Full
Filter & sort โŒ โœ…
Suggested actions โŒ โœ…
Mobile responsive Partial โœ… Full
Configuration Limited โœ… Extensive

๐Ÿ› ๏ธ Development

Setup

git clone https://github.com/nireshs/pytest-html-dashboard.git
cd pytest-html-dashboard
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -e ".[dev]"

Run Tests

pytest tests/ --cov=pytest_html_dashboard --cov-report=html

Build Package

python -m build

๐Ÿค Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Submit a pull request

๐Ÿ“ License

MIT License - see LICENSE file for details.

๐Ÿ™ Credits

๐Ÿ“ฎ Support

๐Ÿ—บ๏ธ Roadmap

  • Historical test trend analysis
  • Test comparison between runs
  • PDF export capability
  • Real-time test execution dashboard
  • Additional chart types (bar, line, scatter)
  • Custom theme marketplace
  • Integration with test management tools

๐Ÿ“„ Changelog

v1.1.0 (2025-11-22)

  • โœจ Complete dashboard enhancement system
  • ๐Ÿ“Š Interactive Chart.js visualizations
  • ๐ŸŽจ Modern gradient styling with responsive design
  • ๐Ÿ” Intelligent error classification
  • โš™๏ธ Comprehensive configuration system
  • ๐Ÿ“‹ Enhanced test tables with filter/sort
  • ๐Ÿš€ Automatic enhancement via pytest hooks

โญ Star us on GitHub if you find this useful! โญ

Made with โค๏ธ for the pytest community

Project details


Download files

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

Source Distribution

pytest_html_dashboard-1.1.0.tar.gz (36.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_html_dashboard-1.1.0-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file pytest_html_dashboard-1.1.0.tar.gz.

File metadata

  • Download URL: pytest_html_dashboard-1.1.0.tar.gz
  • Upload date:
  • Size: 36.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for pytest_html_dashboard-1.1.0.tar.gz
Algorithm Hash digest
SHA256 79de83a11e7feed1fa4872c8592c71e07ac2b9a3306a90cec71c257ce0e59d8c
MD5 25738be99223d6ffa2d656f2da5d1c56
BLAKE2b-256 e93d2d9d22531ea0fb26f4c46367f99988840f7e7382c9a03191f3a5d914731d

See more details on using hashes here.

File details

Details for the file pytest_html_dashboard-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_html_dashboard-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 420a87668cba5234f64c3b9594b6c45b3f1e9f59c671665156958a3bc29e367f
MD5 99fdd59f60b1ee56d37022a7aab492c9
BLAKE2b-256 d2958be0e0286f050d602996daae1a55bb95e7f7db23ddb794bfbf178196e0dd

See more details on using hashes here.

Supported by

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