seo排名工具站长,管理咨询公司注册,高能建站系统怎么收费,做it的中国企业网站测试步骤1. 导入unittest模块import unittest2. 编写测试的类继承unittest.TestCaseclass Tester(unittest.TestCase)3. 编写测试的方法必须以test开头def test_add(self)def test_sub(self)4.使用TestCase class提供的方法测试功能点5.调用unittest.main()方法运行所有以test开…测试步骤1. 导入unittest模块import unittest2. 编写测试的类继承unittest.TestCaseclass Tester(unittest.TestCase)3. 编写测试的方法必须以test开头def test_add(self)def test_sub(self)4.使用TestCase class提供的方法测试功能点5.调用unittest.main()方法运行所有以test开头的方法if __name__ __main__:unittest.main()实例如下被测试类#!/usr/bin/python#codingutf-8class Computer(object):staticmethoddef add(a, b):return a b;staticmethoddef sub(a, b):return a - b; 测试类#!/usr/bin/python#codingutf-8import unittestfrom Testee import Computerclass Tester(unittest.TestCase):def test_add(self):self.assertEqual(Computer.add(2, 3), 5, test add function)def test_sub(self):self.assertEqual(Computer.sub(5, 1), 4, test sub function)if __name__ __main__:unittest.main()运行结果:----------------------------------------------------------------------Ran 2 tests in 0.000sOK