python appium unittest 启动一次app,执行多条test

时间:2022-12-06 18:50:12

参考地址 https://blog.csdn.net/YZF_DD/article/details/85118078

执行用例过程中只启动一次app,减少代码运行时间,利于代码封装

@classmethod
setUpClass
tearDownClass
python appium unittest 启动一次app,执行多条testpython appium unittest 启动一次app,执行多条test
 1 class TestCase(unittest.TestCase):
 2     @classmethod
 3     def setUpClass(self):
 4         print(开始测试)
 5         self.driver = DriverApp().driver()
 6 
 7     # 滑动手机屏幕
 8     def test_001(self):
 9         for i in range(2):
10             GestureMainpulation().swipe_left(self.driver)
11 
12     # 点击立即体验
13     def test_002(self):
14         AppActions().a(self.driver)
15 
16     @classmethod
17     def tearDownClass(self):
18         print("结束测试")
View Code