class Test(unittest.TestcCase):
	@classmethod
	def setupClass(cls):
		print('打开浏览器')
	def test1(self):
		print(1)
	def test2(self):
		print(2)
	def test3(self):
		print(3)
	@classmethod	
	def tearDownClass(cls):
		print('关闭浏览器')
if __name__ == '__main__':
	unittest.main()

执行结果:

打开浏览器
1
2
3
关闭浏览器