Project: html-testrunner

A Test Runner in python, for Human Readable HTML Reports

Project Details

Latest version
1.2.1
Home Page
https://github.com/oldani/HtmlTestRunner
PyPI Page
https://pypi.org/project/html-testrunner/

Project Popularity

PageRank
0.0015183609682627207
Number of downloads
817457

=============================== HtmlTestRunner

.. image:: https://img.shields.io/pypi/v/html-testRunner.svg :target: https://pypi.python.org/pypi/html-testRunner

.. image:: https://img.shields.io/travis/oldani/HtmlTestRunner.svg :target: https://travis-ci.org/oldani/HtmlTestRunner

HtmlTest runner is a unittest test runner that save test results in Html files, for human readable presentation of results.

This Package was inspired in unittest-xml-reporting and HtmlTestRunner by tungwaiyip.

Usage:

.. code-block:: python

import HtmlTestRunner
import unittest


class TestStringMethods(unittest.TestCase):

    def test_upper(self):
        self.assertEqual('foo'.upper(), 'FOO')

    def test_error(self):
        """ This test should be marked as error one. """
        raise ValueError

    def test_fail(self):
        """ This test should fail. """
        self.assertEqual(1, 2)

    @unittest.skip("This is a skipped test.")
    def test_skip(self):
        """ This test should be skipped. """
        pass

if __name__ == '__main__':
    unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output='example_dir'))

As simple as import the class an initialize it, it only have one request parameter that is output, this one is use to place the report in a sub direcotry in reports directory.

Links:

  • Github <https://github.com/oldani/HtmlTestRunner>_