Created
July 9, 2011 07:47
-
-
Save jayakumarc/1073424 to your computer and use it in GitHub Desktop.
HTMLTestRunner usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import HTMLTestRunner | |
class SampleTest(unittest.TestCase): | |
def test_pass(self): | |
"""Test to demonstrate pass condition""" | |
self.assertTrue(True) | |
def test_fail(self): | |
"""Test to demonstrate fail condition""" | |
self.assertTrue(False) | |
def suite(): | |
s1 = unittest.TestLoader().loadTestsFromTestCase(SampleTest) | |
return unittest.TestSuite([s1]) | |
def run(suite, report = "report.html"): | |
with open(report, "w") as f: | |
HTMLTestRunner.HTMLTestRunner( | |
stream = f, | |
title = 'Sample report', | |
verbosity = 2, | |
description = 'Sample test for HTMLTestRunner usage' | |
).run(suite) | |
if __name__ == "__main__": | |
run(suite()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
its generating bank html. can you pls let me know how to generate the report with results