I run automatic testing using an Android emulator running an application with a Monkey script written in Python. The script copies files to the emulator, presses buttons in the application, and reacts depending on the actions that the software launches while it is running. The script is supposed to run the loop several thousand times, so I have this in the loop to run the adb tool to copy files, run actions and see how the software responds by calling the getProperty method on the device with the parameter "am.current.comp. class ". So here is a very simplified version of my script:
for target in targets:
androidSDK.copyFile(emulatorName, target, '/mnt/sdcard')
device.startActivity(component='com.myPackage/com.myPackage.myactivity')
while 1:
if device.getProperty('am.current.comp.class') == 'com.myPackage.anotheractivity':
time.sleep(1)
device.touch(100, 100, 'DOWN_AND_UP')
break
time.sleep(0.1)
(androidSDK - , , adb).
, script , ( )
[com.android.chimpchat.adb.AdbChimpDevice]com.android.ddmlib.ShellCommandUnresponsiveException
[com.android.chimpchat.adb.AdbChimpDevice] Unable to get variable: am.current.comp.class
[com.android.chimpchat.adb.AdbChimpDevice]java.net.SocketException: Software caused connectionabort: socket write error
, - ( adb kill-server).
, , , Java (Monkey Jython), , Python script. script , (, , , MonkeyRunner.waitForConnection ?).
?
,
. , , , Jython script Java , - :
from java.net import SocketException
...
try:
...
except(SocketException):
...