android - MonkeyRunner instrumentation sends a ShellCommandUnresponsiveException during test execution -


i trying run test instrumentations using monkeyrunner, somehow can't work should. after few seconds of test, execution stops shellcommandunresponsiveexception, while test still running on device.

my monkeyrunner script following :

# -*- coding: utf-8 -*-  # imports monkeyrunner modules used program import os com.android.monkeyrunner import monkeyrunner, monkeydevice  # connects current device, returning monkeydevice object device = monkeyrunner.waitforconnection()  # variables commands params = dict() params['class'] = 'com.foo.test.testcases#testmethod'  device.instrument('com.foo.test.test/android.test.instrumentationtestrunner', params) 

and exception

160205 17:33:48.856:s [mainthread] [com.android.chimpchat.adb.adbchimpdevice] error executing command: instrument -w -r -e class com.foo.test.testcases#testmethod com.foo.test.test/android.test.instrumentationtestrunner 160205 17:33:48.856:s [mainthread] [com.android.chimpchat.adb.adbchimpdevice] com.android.ddmlib.shellcommandunresponsiveexception ... 

what not understand if try use mentioned command separately adb shell works fine , test passes, problem doesn't come command's syntax or test being executed.

i tried replacing device.instrument device.shell , input command, , while doesn't throw exception not wait end of test before moving on rest of code.

the problem might come fact tests use thread.sleep() wait time. noticed 1 of tests had short sleep time seems pass , not cause exception. there way prevent exception happening ? guess switch device.shell method , wait arbitrary amount of time, considerably slow down tests cannot predict how long test be.

i think can use androidviewclient/culebra achieve goal. more if take @ runteststhread class need. take @ usage, way adbclient created no timeout in uiautomatorhelper.__runtests:

# need new adbclient instance timeout=none (means, no timeout) long running test service newadbclient = adbclient(self.adbclient.serialno, self.adbclient.hostname, self.adbclient.port, timeout=none) self.thread = runteststhread(adbclient=newadbclient, testclass=self.test_class, testrunner=self.test_runner) if debug:     print >> sys.stderr, "__runtests: starting thread" self.thread.start() 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -