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 32 33 34 35 36 37 38 39 40
| import unittest
class Task_B(unittest.TestCase): def setUp(self): print('Initial Task B') def test_002(self): print('Task B test 2')
def test_001(self): print('Task B test 1')
def tearDown(self): print('Task B Teardown') def NO(self): print('this method can\'t be executed')
class Task_A(unittest.TestCase): def setUp(self): print('Initial Task A') def test_002(self): print('Task A test 2')
def test_001(self): print('Task A test 1')
def tearDown(self): print('Task A Teardown') if __name__ == '__main__': unittest.main() print('发现按字典序执行')
|