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.3.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

htmltestrunner_rv-1.1.3-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file htmltestrunner_rv-1.1.3.tar.gz.

File metadata

  • Download URL: htmltestrunner_rv-1.1.3.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for htmltestrunner_rv-1.1.3.tar.gz
Algorithm Hash digest
SHA256 dbb608bef31d94cee896b19b832fdd3a263fc460ffe94401c7556b4dacb48e7b
MD5 b08ecca48c210c64106c5b1e972e969f
BLAKE2b-256 fb175cf638f9c37e0b643f2de5bfcba94c94472f89c0a0042489ec50cea5d7a8

See more details on using hashes here.

File details

Details for the file htmltestrunner_rv-1.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for htmltestrunner_rv-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dddb0d370266260a792d69bdc8440d35807840737566eb66d82952d63d421da7
MD5 58f5414301ede073ae85ba21a150717b
BLAKE2b-256 99615fc5b4ae73cf06e6c044d11b42421ead8ecea5992354d523c0c5cff0233d

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