A Test Runner in python, for Human Readable HTML Reports
Project description
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.
This project was created due to needs of getting human readables reports for test runned, i found one but was lack and with a lot of bad practice, but i liked how xml-reporting works. So i create this one that incorporated code from both projects but up to date.
Usage:
import HtmlTestRunner
import unittest
class TestStringMethods(unittest.TestCase):
""" Example test for HtmlRunner. """
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())
def test_split(self):
s = 'hello world'
self.assertEqual(s.split(), ['hello', 'world'])
# check that s.split fails when the separator is not a string
with self.assertRaises(TypeError):
s.split(2)
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.
Console output:
Test Result:
TODO
Add test and docs
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
1 (2017-01-28)
First release on PyPI.
1.0.1 (2017-01-29)
Rename package due to conflict in PyPI.
1.0.2 (2017-01-29)
Fix broken docs.
1.0.3 (2017-01-29)
Fix bug with the template not beign include in the package.
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
Built Distribution
Hashes for html_testRunner-1.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0f136de263f1689242519e641a2463e3e50cb6c998235138743cdeaca88c03c |
|
MD5 | 7048ad393062b4e3249835f482b4820d |
|
BLAKE2b-256 | ec1e6832259cdb78c6cfef0bc6ad2b89226d2627d99756527f4c7692f8a94886 |