Python Unittest Reports:
I use HTMLTestRunner for generating HTMLReports. HTMLTestRunner is an extension to the Python standard library’s unittest module. It generates easy to use HTML test reports.You can download HTMLTestRunner from "https://github.com/tungwaiyip/HTMLTestRunner.git"
View sample report by clicking here.
How to use:
Download the HTMLTestRunner.py file from the above source and keep it in your source dir.
sample program:
import HTMLTestRunner
import unittest
class htmlreportsdemo(unittest.TestCase):
""" class description
"""
def test_pass(self):
""" test description
"""
pass
def test_fail(self):
""" test description
"""
self.fail()
I use HTMLTestRunner for generating HTMLReports. HTMLTestRunner is an extension to the Python standard library’s unittest module. It generates easy to use HTML test reports.You can download HTMLTestRunner from "https://github.com/tungwaiyip/HTMLTestRunner.git"
View sample report by clicking here.
How to use:
Download the HTMLTestRunner.py file from the above source and keep it in your source dir.
sample program:
import HTMLTestRunner
import unittest
class htmlreportsdemo(unittest.TestCase):
""" class description
"""
def test_pass(self):
""" test description
"""
pass
def test_fail(self):
""" test description
"""
self.fail()
suite =
unittest.TestLoader().loadTestsFromTestCase(htmlreportsdemo) #replace htmlreportsdemo with your class name
unittest.TextTestRunner(verbosity=2)
output = open("results.html","w")
runner =
HTMLTestRunner.HTMLTestRunner(stream=output,title='Test Report',description='This is for
demonstrating HTMLTestResults')
runner.run(suite)
Thanks for sharing this!
ReplyDeleteDo visit our websites :
Software Testing Online Training