Python????????????????unittest
?????????? ???????[ 2017/2/28 16:08:52 ] ??????????????? ???????
??????????????????????????????python???????????????????????unittest?? testtools?? subunit?? coverage?? testrepository?? nose?? mox?? mock?? fixtures?? discover???????setuptools?? distutils?????Щ?????????д??????????????????е????????N????????????????????????????????????????????????????????????????????????д?ù?????????д?ò?????????????????????????????????????????????????????????????????????????????????????Щ??????????????????????д???·????????????
????????????unittest????????python?е??????飬????????????????????ο??????????????????http://docs.python.org/2.7/library/unittest.html?????????????д???????????????????????????????Щ??????????????????????????Щ???????????unittest??????????????????????????????
????unittest?????python?汾??junit??junit??java?е????????????java?????????????仰?????У?Keep the bar green?????????eclipseд??java????????????????unittest???????junit?е???????????????????test case?? test suite????????????????????????ò???????????????
???????????????????unittest?е?4??????????test fixture?? test case?? test suite?? test runner????????????????????????????????????????????????????????Χ???????????????????????
?????????????unittest???????????????????????????????????????????????????????侲???????£?
???????TestCase????????????????????????????????????????????????????????????????????????(setUp)????в??????(run)????????????????(tearDown)???????(unit test)????????????????????????????????????????????????????????????????????????????????
????????????????????????????TestSuite??????TestSuite????????TestSuite??
????TestLoader??????????TestCase??TestSuite?е???????м???loadTestsFrom__()??????????????????TestCase???????????????????add??TestSuite?У?????????TestSuite?????
????TextTestRunner??????в?????????????е?run(test)?????TestSuite/TestCase?е?run(result)??????
??????????????浽TextTestResult????У??????????????????????????????????????????????
?????????????????????????????д??TestCase???????TestLoader????TestCase??TestSuite???????TextTestRunner??????TestSuite?????е?????????TextTestResult?У??????????????unittest.main????С?
????????????漰????test case?? test suite?? test runner?????????????????test fixture?????????????test fixture???????TestCase??docstring??????????λ???
????Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively.
?????????????????????????????????????????fixture?????????TestCase??setUp()??tearDown()???????????????????????????????????????????????????????????????setUp()?н????????????????????Щ?????????tearDown()?????????????в???????????????????????tearDown?????????????????TestCase?????????????????????fixture????????????????????fixtures??????????????????????
???????????????????????????????????????????????????£???unittest????????????
????TestSequenceFunctions?????unittest.TestCase????д??setUp()?????????????????????'test'???????????????TestSequenceFunctions?????????????????????????????????????????????????????????????????????????????TestCase?????????????????????????????????test_*()????????????????????????????????????????ЩTestLoader????μ????????????????????????loader.TestLoader?????????loadTestsFromTestCase()??????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11