How to use reportErrorsInQueue method in fMBT

Best Python code snippet using fMBT_python

fmbttizen.py

Source:fmbttizen.py Github

copy

Full Screen

...490 else: # using SSH491 ok, self._platformInfo = self._agentCmd("")492 pass # agent already started by remoteShellCmd493 return ok494 def reportErrorsInQueue(self):495 while True:496 try: l = self._sdbShellErrQueue.get_nowait()497 except Queue.Empty: return498 if self._debugAgentFile: self._debugAgentFile.write("<2 %s" % (l,))499 _adapterLog("fmbttizen agent error: %s" % (l,))500 def close(self):501 if self._sdbShell != None:502 try: self._agentCmd("quit", retry=0)503 except: pass504 try: self._sdbShell.terminate()505 except: pass506 try: self._sdbShell.stdin.close()507 except: pass508 try: self._sdbShell.stdout.close()509 except: pass510 try: self._sdbShell.stderr.close()511 except: pass512 self.reportErrorsInQueue()513 _g_sdbProcesses.remove(self._sdbShell)514 self._sdbShell = None515 def _agentAnswer(self):516 errorLinePrefix = "FMBTAGENT ERROR "517 okLinePrefix = "FMBTAGENT OK "518 l = self._sdbShell.stdout.readline()519 output = []520 while True:521 if self._debugAgentFile:522 if len(l) > 72: self._debugAgentFile.write("<1 %s...\n" % (l[:72],))523 else: self._debugAgentFile.write("<1 %s\n" % (l,))524 if l.startswith(okLinePrefix):525 return True, _decode(l[len(okLinePrefix):])526 elif l.startswith(errorLinePrefix):527 return False, _decode(l[len(errorLinePrefix):])528 else:529 output.append(l)530 pass531 l = self._sdbShell.stdout.readline()532 if l == "":533 raise IOError("Unexpected termination of sdb shell: %s" % ("\n".join(output)))534 l = l.strip()535 def _agentCmd(self, command, retry=3):536 if command[:2] in ["tt", "td", "tm", "tu", "er"]:537 # Operating on coordinates on with a touch devices538 # may require information on screen resolution.539 # The agent does not know about possible rotation, so540 # the resolution needs to be sent from here.541 if self._agentNeedsResolution:542 self._agentCmd("sd %s %s" % self._gti.screenSize())543 self._agentNeedsResolution = False544 if self._sdbShell == None: return False, "disconnected"545 if self._debugAgentFile: self._debugAgentFile.write(">0 %s\n" % (command,))546 if self._useSdb:547 eol = "\r"548 else:549 eol = "\n"550 try:551 if len(command) > 0:552 self._sdbShell.stdin.write("%s%s" % (command, eol))553 self._sdbShell.stdin.flush()554 except IOError, msg:555 if retry > 0:556 time.sleep(.2)557 self.reportErrorsInQueue()558 _adapterLog('Error when sending command "%s": %s.' % (command, msg))559 self.open()560 self._agentCmd(command, retry=retry-1)561 else:562 raise563 return self._agentAnswer()564 def sendPress(self, keyName):565 return self._agentCmd("kp %s" % (keyName,))[0]566 def sendKeyDown(self, keyName):567 return self._agentCmd("kd %s" % (keyName,))[0]568 def sendKeyUp(self, keyName):569 return self._agentCmd("ku %s" % (keyName,))[0]570 def sendMtLinearGesture(self, *args):571 return self._agentCmd("ml %s" % (_encode(args)))[0]...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful