forked from SeldomQA/XTestRunner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_HTMLTestRunner.py
More file actions
31 lines (23 loc) · 845 Bytes
/
test_HTMLTestRunner.py
File metadata and controls
31 lines (23 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import HTMLTestRunner
import unittest
class TestDemo(unittest.TestCase):
def test_success(self):
self.assertEqual(5, 5)
def test_success2(self):
self.assertEqual(20, 20)
def test_fail(self):
self.assertEqual(5, 6)
def test_error(self):
self.assertEqual(a, 6)
if __name__ == '__main__':
testunit=unittest.TestSuite()
testunit.addTest(TestDemo("test_success"))
testunit.addTest(TestDemo("test_success2"))
testunit.addTest(TestDemo("test_fail"))
testunit.addTest(TestDemo("test_error"))
fp = open('./result.html', 'wb')
runner =HTMLTestRunner.HTMLTestRunner(stream=fp,
title=u'<project name>test report',
description=u'describe: ... ')
runner.run(testunit)
fp.close()