Best Python code snippet using Airtest
test_api.py
Source:test_api.py
...29 set_current(len(G.DEVICE_LIST))30 def test_shell(self):31 output = shell("pwd")32 self.assertIn("/", output)33 def test_shell_error(self):34 with self.assertRaises(AdbShellError):35 output = shell("nimeqi")36 self.assertIn("nimei: not found", output)37 def test_install(self):38 if PKG in self.dev.list_app():39 uninstall(PKG)40 install(APK)41 self.assertIn(PKG, self.dev.list_app())42 def test_uninstall(self):43 if PKG not in self.dev.list_app():44 install(APK)45 uninstall(PKG)46 self.assertNotIn(PKG, self.dev.list_app())47 def test_start_app(self):...
test_utils.py
Source:test_utils.py
...17 def test_empty_string(self):18 """Test that an empty string result is handled as expected"""19 with patch(CHECK_OUTPUT, return_value=b''):20 self.assertEqual(subler_executable(), 'SublerCLI')21 def test_shell_error(self):22 """Test that subprocess.CalledProcessErrors are handled gracefully"""23 with patch(CHECK_OUTPUT,24 side_effect=subprocess.CalledProcessError(1, '')):25 self.assertEqual(subler_executable(), '')26class GetOutputTests(unittest.TestCase):27 """Tests for the get_output function"""28 def setUp(self):29 self.date_output = b'Mon Jul 20 21:48:58 EDT 2015'30 self.expected = self.date_output.decode('UTF-8').strip()31 def test_list(self):32 """Test that CHECK_OUTPUT properly handles accepting and passing off a33 provided list of commandline arguments34 """35 args = ['date']...
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!!