Best Python code snippet using Airtest
test_adb.py
Source:test_adb.py
...9class TestADBWithoutDevice(unittest.TestCase):10 @classmethod11 def setUpClass(cls):12 cls.adb = ADB()13 def test_adb_path(self):14 self.assertTrue(os.path.exists(self.adb.builtin_adb_path()))15 def test_start_server(self):16 self.adb.start_server()17 def test_version(self):18 self.assertIn("1.0.39", self.adb.version())19 def test_other_adb_server(self):20 adb = ADB(server_addr=("localhost", 5037))21 self.assertIn("1.0.39", adb.version())22 def test_start_cmd(self):23 proc = self.adb.start_cmd("devices", device=False)24 self.assertIsInstance(proc, subprocess.Popen)25 self.assertIsNotNone(proc.stdin)26 self.assertIsNotNone(proc.stdout)27 self.assertIsNotNone(proc.stderr)...
test_sdk_manager.py
Source:test_sdk_manager.py
...26 if sys.platform.lower() == 'win32':27 assert sdk_manager.emulator_path == tmp_dir.joinpath("emulator", "emulator.exe")28 else:29 assert sdk_manager.emulator_path == tmp_dir.joinpath("emulator", "emulator")30 def test_adb_path(self, tmp_path):31 tmp_dir = tmp_path / "adb"32 tmp_dir.mkdir(exist_ok=True)33 sdk_manager = SdkManager(sdk_dir=tmp_dir, bootstrap=True)34 if sys.platform.lower() == 'win32':35 assert sdk_manager.adb_path == tmp_dir.joinpath("platform-tools", "adb.exe")36 else:37 assert sdk_manager.adb_path == tmp_dir.joinpath("platform-tools", "adb")38 def test_bootstrap(self, tmp_path, monkeypatch):39 asdk = os.environ["ANDROID_SDK_ROOT"]40 tmp_dir = tmp_path / "bootstrap"41 tmp_dir.mkdir(exist_ok=False)42 try:43 del os.environ["ANDROID_SDK_ROOT"]44 with pytest.raises(FileNotFoundError):...
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!!