I am having an problem in generating html report with HTMLTestRunner. I have created a test suite in a file called TestsSuite.py. Here\'s the code excerpt:
i
firstly, I don't think HTMLTestRunner works with Python 3.x... so you are out of luck. But let's assume you are trying in Python 2.7...
You have a slew of problems. You should really read the docs for unittest and HTMLTestRunner.
However, Consider this example, which achieves similar in python 2:
import unittest
from HTMLTestRunner import HTMLTestRunner
class TestFoo(unittest.TestCase):
def test_foo(self):
self.assertTrue(True)
class TestBar(unittest.TestCase):
def test_bar(self):
self.assertFalse(False)
if __name__ == '__main__':
loader = unittest.TestLoader()
suite = unittest.TestSuite((
loader.loadTestsFromTestCase(TestFoo),
loader.loadTestsFromTestCase(TestBar)))
outfile = file('Report.html', 'w')
runner = HTMLTestRunner(stream=outfile,
verbosity=2,
title='LinkedIn Report',
description='This is a demo report')
runner.run(suite)