Skip to main content

HTMLTestRunner for unit test framework

Project description

HTMLTestRunner

HTMLTestRunner for python3 

A TestRunner for use with the Python unit testing framework. 
It generates a HTML report to show the result at a glance.
It logs stdout to *.txt file with timestamp
Easy to find bugs

# Click here for HTMLTestRunner-rv documentation

#Installation:

pip install HTMLTestRunner-rv

Creating suite

my_test_suite = unittest.TestSuite()

output to a file

runner = HTMLTestRunner(
title='My unit test', open_in_browser=True)

run the test

runner.run(my_test_suite)

#Example code:

import unittest

from HTMLTestRunner.runner import HTMLTestRunner
from tests.test_1 import TestCase1
from tests.test_2 import TestCase2

test1 = unittest.TestLoader().loadTestsFromTestCase(TestCase1)
test2 = unittest.TestLoader().loadTestsFromTestCase(TestCase2)
suite = unittest.TestSuite([test1, test2])
runner = HTMLTestRunner(log=True, verbosity=2, output='report', title='Test report', report_name='report',
                        open_in_browser=True, description="HTMLTestReport", tested_by="Ravikirana B",
                        add_traceback=False)

runner.run(suite)

Now you can pass external css styling and javascript for report

Example:

style = """
    .heading {
    margin-top: 0ex;
    margin-bottom: 1ex;
    border-style:ridge;
    color:white;
    background-color:#999900;
    font-weight:bold;
    }
"""
script = """
    Your script
"""
runner = HTMLTestRunner(log=True, verbosity=2, output='report', title='Test report', report_name='report',
                        open_in_browser=True, description="HTMLTestReport", script=script, style=style)

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

HTMLTestRunner-rv-1.1.2.tar.gz (13.5 kB view details)

Uploaded Source

File details

Details for the file HTMLTestRunner-rv-1.1.2.tar.gz.

File metadata

  • Download URL: HTMLTestRunner-rv-1.1.2.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.0

File hashes

Hashes for HTMLTestRunner-rv-1.1.2.tar.gz
Algorithm Hash digest
SHA256 2d965ff8fc4834b57e9cbd7039214f28c4677e58871e32d136230da95e258229
MD5 160b7015ae36191ea8378a15268e4e6d
BLAKE2b-256 78c92d3f7e338d8a136913791a8a5899c9f83fa9a07bac25119db01d1caebb50

See more details on using hashes here.

Supported by

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