Best Python code snippet using Airtest
test_android.py
Source:test_android.py
...42 self.assertIn(PKG, app_path)43 self.assertTrue(app_path.startswith("/"))44 with self.assertRaises(AirtestError):45 self.android.path_app('com.netease.this.is.error')46 def test_check_app(self):47 self._install_test_app()48 self.assertTrue(self.android.check_app(PKG))49 with self.assertRaises(AirtestError):50 self.android.check_app('com.netease.this.is.error')51 def test_snapshot(self):52 self._install_test_app()53 for i in (CAP_METHOD.ADBCAP, CAP_METHOD.MINICAP, CAP_METHOD.MINICAP_STREAM, CAP_METHOD.JAVACAP):54 filename = "./screen.png"55 if os.path.exists(filename):56 os.remove(filename)57 self.android.cap_method = i58 self.android.wake()59 screen = self.android.snapshot(filename=filename)60 self.assertIsInstance(screen, numpy.ndarray)...
test_config.py
Source:test_config.py
...13 self.assertRaises(libameh.exceptions.MissingConfig,14 libameh.config.Config, 'bogus.ini')15 def test_apps(self):16 self.assertEqual(self.config.apps(), ['jira', 'confluence'])17 def test_check_app(self):18 self.assertTrue(self.config.check_app('jira'))19 self.assertTrue(self.config.check_app('confluence'))20 def test_check_app_unknown_app(self):21 self.assertRaises(libameh.exceptions.UnknownApplication,22 self.config.check_app, 'bogus')23 def test_properties_string(self):24 props = self.config.properties_string('jira')25 self.assertIn('jira home', props)26 self.assertIn('jira install', props)27 def test_properties_string_unknown_app(self):28 self.assertRaises(libameh.exceptions.UnknownApplication,29 self.config.properties_string, 'bogus')30 def test_property(self):31 self.assertEqual(self.config.property('jira', 'install'),...
test_specmanager.py
Source:test_specmanager.py
...15 cls.sm.reload()16 def test_apps_present(self):17 # on startup, should have app_specs18 self.assertTrue(self.good_tag in self.sm.app_specs)19 def test_check_app(self):20 # good id and good tag21 self.assertTrue(self.sm.check_app(self.good_app_id, self.good_tag))22 # good id and bad tag no raise23 self.assertFalse(self.sm.check_app(self.good_app_id, self.bad_tag))24 # bad id and good tag no raise25 self.assertFalse(self.sm.check_app(self.bad_app_id, self.good_tag))26 # bad id with raise27 with self.assertRaises(ValueError):28 self.sm.check_app(self.bad_app_id, raise_exception=True)29 @mock.patch("biokbase.narrative.jobs.specmanager.clients.get", get_mock_client)30 def test_get_type_spec(self):31 self.sm.reload()32 self.assertIn(33 "export_functions", list(self.sm.get_type_spec("KBaseFBA.FBA").keys())...
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!!