A TestRunner for use with the Python unittest framework, which generates report in nice HTML files.
Project description
html-reporter
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.
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)
Free software: MIT license
Documentation: https://html-reporter.readthedocs.io.
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
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
This package was inspired by HTMLTestRunner.py written by Wai Yip Tung.
History
0.2.6 (2022-05-13)
First tested release on pypi.
Support and tested with Python3.7 -> Python 3.9.
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
File details
Details for the file html_reporter-0.2.6.tar.gz
.
File metadata
- Download URL: html_reporter-0.2.6.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c031b5032cded95b0671c098d3c0f42273cd9615cab5cbe5482a48ea9097393d |
|
MD5 | 498116b8cfd71b101212dc62d6fc0e0b |
|
BLAKE2b-256 | e488b858c450076bcc50c63b4bfd1d3623164d24f8c3d6596e62307ea2f76682 |
File details
Details for the file html_reporter-0.2.6-py2.py3-none-any.whl
.
File metadata
- Download URL: html_reporter-0.2.6-py2.py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c60dcca81b4acc4e18b80e5445178014b1b45743426b8ffb7ff5b97d13daf752 |
|
MD5 | 7e5929859efed5fcf84cbc6dafae4ede |
|
BLAKE2b-256 | 8ccb26aedbe44684ef5a0bd368911efec6c172408b06ab11b7cfb3d7d1c6329a |