import unittest
class TestMethod(unittest.TestCase):
#在所有case执行之前执行
@classmethod
def setUpClass(cls):
print ('In front of all the cases, and just run once.')
#在所有case执行之后执行
@classmethod
def tearDownClass(cls):
print ('Behind all the cases, and just run once.')
#在每条case执行之前执行
def setUp(self):
print ('test-->setUp')
#在每条case执行之后执行
def tearDown(self):
print ('test-->tearDown')
#case1
def test_01(self):
print ('This is the 1st case.')
#case2
def test_02(self):
print ('This is the 2nd case.')
if __name__ == '__main__':
unittest.main()