Best Python code snippet using Airtest
test_adb.py
Source:test_adb.py  
...102        sn, local, remote = forwards[0]103        self.assertEqual(sn, self.adb.serialno)104        self.assertEqual(local, 'tcp:6100')105        self.assertEqual(remote, 'tcp:7100')106    def test_remove_forward(self):107        self.adb.remove_forward()108        self.assertEqual(len(list(self.adb.get_forwards())), 0)109        # set a remote and remove it110        self.adb.forward(local='tcp:6100', remote="tcp:7100")111        self.adb.remove_forward(local='tcp:6100')112        self.assertEqual(len(list(self.adb.get_forwards())), 0)113    def test_logcat(self):114        line_cnt = 0115        for line in self.adb.logcat():116            self.assertIsInstance(line, str)117            line_cnt += 1118            if line_cnt > 3:119                break120        self.assertGreater(line_cnt, 0)...public_gateway_test.py
Source:public_gateway_test.py  
...98        fwd = {'name': 'forward', 'srcport': 34, 'dstip': '192.168.1.228', 'dstport': 80}99        self.service.add_portforward(fwd)100        self.gwservice.schedule_action.assert_called_once_with('add_portforward', args=AlwaysTrue())101        assert self.list_name_contains(self.service.data['portforwards'], 'forward')102    def test_remove_forward(self):103        self.test_add_portforward()104        self.service.remove_portforward('forward')105        self.gwservice.schedule_action.assert_called_with('remove_portforward', args=AlwaysTrue())...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!!
