Skip to main content

html-reporter

https://img.shields.io/pypi/v/html-reporter.svg https://img.shields.io/travis/phongnt570/html-reporter.svg Documentation Status License Supported Python Versions

A TestRunner for use with the Python unit testing framework. It generates a report in an HTML file to show the results at a glance. This package was inspired by HTMLTestRunner.py written by Wai Yip Tung and began with transforming the old code to use Jinja2 template and adopting Bootstrap 5 CSS.

Test Results

Getting started

Prerequisites

html-reporter requires Python 3.7 or later.

Install

Install the package via pip:

$ pip install html-reporter

Usage

HTMLTestRunner is a counterpart to unittest.TextTestRunner. Instantiate an HTMLTestRunner object and use it to run your test suite.

Example using unittest.main:

import unittest

from html_reporter import HTMLTestRunner

# output to a file
if __name__ == "main":
    runner = HTMLTestRunner(
        report_filepath="my_report.html",
        title="My unit test",
        description="This demonstrates the report output by HTMLTestRunner.",
        open_in_browser=True
    )

    # run the test
    unittest.main(testRunner=runner)

Example using unittest.TestSuite:

import unittest
from html_reporter import HTMLTestRunner

# output to a file
if __name__ == "main":
    my_test_suite = unittest.TestSuite()  # define your test suite
    # add your test cases:
    # my_test_suite.addTest(...)

    runner = HTMLTestRunner(
        report_filepath="my_report.html",
        title="My unit test",
        description="This demonstrates the report output by HTMLTestRunner.",
        open_in_browser=True
    )

    # run the test
    runner.run(my_test_suite)

Features

TODO

  • [x] Switch to Jinja2 template

  • [x] Refactor

  • [x] Add support for skipped tests

  • [x] Release pypi package

  • [ ] Option for combine/separate report files

  • [ ] Add tests

  • [ ] Improve documentations

Credits

History

0.2.6 (2022-05-13)

  • First tested release on pypi.

  • Support and tested with Python3.7 -> Python 3.9.

Metadata

Release files for html-reporter 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for html-reporter 0.2.6
File Size Uploaded
html_reporter-0.2.6.tar.gz 1.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for html-reporter 0.2.6
File Interpreter ABI Platform
html_reporter-0.2.6-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 1.4 MB

Release files / html_reporter-0.2.6.tar.gz

Download URL html_reporter-0.2.6.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
c031b5032cded95b0671c098d3c0f42273cd9615cab5cbe5482a48ea9097393d
BLAKE2b-256 checksum
How to use checksums
e488b858c450076bcc50c63b4bfd1d3623164d24f8c3d6596e62307ea2f76682
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.7.1

Release files / html_reporter-0.2.6-py2.py3-none-any.whl

Download URL html_reporter-0.2.6-py2.py3-none-any.whl
Size 12.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c60dcca81b4acc4e18b80e5445178014b1b45743426b8ffb7ff5b97d13daf752
BLAKE2b-256 checksum
How to use checksums
8ccb26aedbe44684ef5a0bd368911efec6c172408b06ab11b7cfb3d7d1c6329a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.2.6 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page