Best Python code snippet using Airtest
minitouch_test.py
Source:minitouch_test.py
...17 @classmethod18 def tearDownClass(cls):19 cls.minitouch.teardown()2021 def _count_server_proc(self):22 output = self.adb.raw_shell("ps").strip()23 cnt = 024 for line in output.splitlines():25 if "minitouch" in line and "do_exit" not in line:26 cnt += 127 return cnt282930class TestMiniTouch(TestMiniTouchBase):31 def test_touch(self):32 self.minitouch.touch((300, 400))3334 def test_swipe(self):35 self.minitouch.swipe((100, 100), (200, 200))3637 def test_opera(self):38 self.minitouch.operate({"type":"down","x":100,"y":400})39 self.minitouch.operate({"type": "move", "x": 200, "y": 400})40 self.minitouch.operate({"type": "move", "x": 200, "y": 500})41 self.minitouch.operate({"type": "move", "x": 300, "y": 500})42 self.minitouch.operate({"type": "up"})4344 def test_pinch(self):45 self.minitouch.pinch()46 self.minitouch.pinch(in_or_out='out')474849class TestMiniTouchBackend(TestMiniTouch):50 @classmethod51 def setUpClass(cls):52 cls.adb = ADB()53 devices = cls.adb.devices()54 if not devices:55 raise RuntimeError("At lease one adb device required")56 cls.adb.serialno = devices[0][0]57 cls.minitouch = Minitouch(cls.adb, backend=True)585960class TestMiniTouchSetup(TestMiniTouchBase):61 def test_0_install(self):62 self.minitouch.uninstall()63 self.minitouch.install()6465 def test_teardown(self):66 self.minitouch.touch((0, 0))67 cnt = self._count_server_proc()68 self.minitouch.teardown()69 self.assertEqual(self._count_server_proc(), cnt - 1)707172if __name__ == '__main__':
...
test_minitouch.py
Source:test_minitouch.py
...12 cls.minitouch = Minitouch(cls.adb)13 @classmethod14 def tearDownClass(cls):15 cls.minitouch.teardown()16 def _count_server_proc(self):17 output = self.adb.raw_shell("ps").strip()18 cnt = 019 for line in output.splitlines():20 if "minitouch" in line and "do_exit" not in line:21 cnt += 122 return cnt23class TestMiniTouch(TestMiniTouchBase):24 def test_touch(self):25 self.minitouch.touch((100, 100))26 def test_swipe(self):27 self.minitouch.swipe((100, 100), (200, 200))28 def test_swipe_along(self):29 self.minitouch.swipe_along([(100, 100), (200, 200), (300, 300)])30 def test_two_finger_swipe(self):31 self.minitouch.two_finger_swipe((100, 100), (200, 200))32 def test_pinch(self):33 self.minitouch.pinch()34 self.minitouch.pinch(in_or_out='out')35class TestMiniTouchBackend(TestMiniTouch):36 @classmethod37 def setUpClass(cls):38 cls.adb = ADB()39 devices = cls.adb.devices()40 if not devices:41 raise RuntimeError("At lease one adb device required")42 cls.adb.serialno = devices[0][0]43 cls.minitouch = Minitouch(cls.adb, backend=True)44class TestMiniTouchSetup(TestMiniTouchBase):45 def test_0_install(self):46 self.minitouch.uninstall()47 self.minitouch.install()48 def test_teardown(self):49 self.minitouch.touch((0, 0))50 cnt = self._count_server_proc()51 self.minitouch.teardown()52 self.assertEqual(self._count_server_proc(), cnt - 1)53if __name__ == '__main__':...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!