unittest.main测试过程
1.收集测试用例
2.根据测试用例生成测试集
3.运行测试集中的测试用例
1.使用unittest.main()执行测试用例
import unittest
from UnitTest.test import Count
class TestCount(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_1_add(self):
self.assertEqual(Count.add(1, 3, 6), 10)
def test_2_sub(self):
self.assertEqual(Count.sub(1, 3, 6), -8)
def test_3_div(self):
self.assertEqual(Count.div(10, 2), 5)
def test_4_mult(self):
self.assertEqual(Count.mult(1, 3, 6), 18)
if __name__ == '__main__':
unittest.main()