Skip to main content

A premium, feature-rich, and beautiful automated testing HTML reporter for pytest, python, and playwright.

Project description

⚡ pytest-apmt-reporter

pytest-apmt-reporter is a premium, feature-rich, and visually stunning automated testing HTML reporter for Python, Pytest, and Playwright. It is designed as a modern, high-fidelity alternative to Allure and Robot Framework, providing responsive layouts, glowing glassmorphic dark-mode dashboards, interactive SVG charts, expandable execution step logs, failure tracebacks, and seamlessly embedded Playwright screenshots.

✨ Features

  • 🔌 True Plug-and-Play (Auto-Detect): By hooking directly into standard pytest entry points, the reporter is automatically active the moment you pip install it. No configuration changes required!
  • 🌐 100% Offline-First (Self-Contained): The final report compiles all layout, styles (CSS), logic (JS), and screenshots (base64 encoded PNGs) into a single, standalone HTML file. It requires absolutely zero Internet connection or CDNs to load, making it perfect for secure environments or CI/CD artifacts.
  • 🎨 Premium Visual Dashboard: Designed with premium glassmorphism card layouts, smooth transition animations, sleek dark mode (with a light theme toggle), and neon indicators for passed/failed tests.
  • 📊 Interactive SVG Charts: Includes clean, responsive circular progress indicators and data distributions drawn directly via SVG and animated with vanilla JS—no heavy charting libraries (like Chart.js) needed.
  • 📸 Auto Playwright Failure screenshots: If a test case utilizes a Playwright page fixture and fails, the reporter automatically captures and embeds a failure screenshot inside the report.
  • 📝 Hierarchical Step Logging: Allows defining nested execution steps using either standard decorators (@apmt.step) or context managers (with apmt.step), mirroring Allure and Robot Framework.
  • 📎 Multi-format Attachments: Programmatically attach raw logs, JSON blobs, HTML widgets, and custom screenshots to any step or stage.

🚀 Installation

You can easily install the reporter directly into your Python virtual environment from your project directory:

# Clone the repository and install in editable mode
pip install -e .

🛠️ Usage

Once installed, running pytest will automatically enable the reporter and generate a file named report.html in your working directory.

Basic Commands

# Run pytest tests and generate the report with default parameters
pytest

# Specify a custom report name or output directory
pytest --apmt-html=outputs/custom_dashboard.html

# Provide a custom title for your report dashboard
pytest --apmt-title="E2E Portal Smoketests"

📝 Code API Examples

1. Step-by-Step Logging

Organize your test cases into nested, readable, and timed blocks:

import pytest_apmt_reporter as apmt

# Using step decorator
@apmt.step("Authenticate credentials")
def login(username, password):
    ...

def test_user_purchase_flow():
    # Using step context manager
    with apmt.step("Initialize customer basket"):
        basket_id = 9988
        
    login("test_user", "password123")

2. Attaching Screenshots and Metadata

Enrich your reports with logs, JSON responses, or manual Playwright screenshots:

import pytest_apmt_reporter as apmt

def test_payment_gateway_api():
    # Attach plain text logs
    apmt.attach("Connecting to stripe sandbox...", name="Stripe API Connection")
    
    # Attach JSON payload
    apmt.attach('{"id": "ch_3M4", "status": "succeeded"}', name="Stripe Response", attachment_type=apmt.AttachmentType.JSON)
    
def test_dashboard_visual(page):
    # Capture and attach a playwright page screenshot manually
    page.goto("https://admin.portal.local")
    apmt.attach_screenshot(page, name="Dashboard Main Panel")

3. Custom Dashboard Environment Stats

Display important execution parameters (like environment, server names, CI build IDs) directly on the metrics header:

import pytest_apmt_reporter as apmt

def test_initialize():
    apmt.set_environment_info("Environment", "Staging-US-East")
    apmt.set_environment_info("Release Version", "v4.12.0-rc2")

📊 Try the Demo

Run the pre-configured demo test suite in the repository to see all features in action:

# Run the demo tests
pytest demo/test_playwright_demo.py --apmt-html=demo_report.html

# Open the beautiful dashboard!
# Windows (PowerShell):
Start-Process demo_report.html
# macOS/Linux:
open demo_report.html

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

apmt_reports-0.1.2.tar.gz (45.8 kB view details)

Uploaded Source

Built Distribution

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

apmt_reports-0.1.2-py3-none-any.whl (47.4 kB view details)

Uploaded Python 3

File details

Details for the file apmt_reports-0.1.2.tar.gz.

File metadata

  • Download URL: apmt_reports-0.1.2.tar.gz
  • Upload date:
  • Size: 45.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for apmt_reports-0.1.2.tar.gz
Algorithm Hash digest
SHA256 67477bd4e2b1325012c7b418e874a7e551d3ff535a4de9e083e4fe5a56c84d65
MD5 e836d80e6faf865513c2397eb428077e
BLAKE2b-256 9a9338e4bbb83f37bb92c969a8c47abd0c4fbca283a75dd29cb6f8a549bd38b6

See more details on using hashes here.

File details

Details for the file apmt_reports-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: apmt_reports-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 47.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for apmt_reports-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c9c088acda7f11f8c2a705fecc0331b649f9d67c919c9bd8c00c67a025c9bf00
MD5 5e2bb89b79a7c867ef08d6016fa1d427
BLAKE2b-256 76fc55023b1a05fbe4d7dfae3052a2f7396bdb6a41fdb8daaf1d7cefc3c4c6de

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