Closed haradreborn closed 10 years ago
You didn't include the script so it's difficult to tell what's happening. On the other hand, why the error is printing the culebra which is in a docstring?
culebra print is a part of my own script, that call 'os.system('python satest.py > _LOGS/launch_log' + start + '.txt')' here is my unlock part:
def unlock():
device, serialno = ViewClient.connectToDeviceOrExit(verbose=False)
print("UNLOCK: init device")
device.wake()
print("UNLOCK: press home")
device.press('KEYCODE_HOME')
vc = ViewClient(*ViewClient.connectToDeviceOrExit())
apps = vc.findViewWithText('Apps')
start = vc.findViewById('com.android.keyguard:id/keyguard_unlock_view_help_text')
stop = vc.findViewById('com.android.keyguard:id/keyguard_message_area')
if (apps is None):
device.drag((start.getX(), start.getY()), (stop.getX(), stop.getY()), 500)
print ("UNLOCK: drug from object - " + start.__tinyStr__() + " to - " + stop.__tinyStr__())
else:
print("UNLOCK: device already unlocked, button apps exists - " + apps.__tinyStr__())
print("UNLOCK: press home")
device.press('KEYCODE_HOME')
if (verify_view('Apps', 0.1, 4) == True):
STATE.append(1)
return True
else:
STATE.append(2)
return False
As I understand, adb can cause that issue, because when it freezes, it starts to create a lot of processes, so I can see 50+ procesess with 'pidof adb', and 5037 port become ESTABLISHMENT. I solved this by 'adb kill/start-server' on each test run.
Why are you invoking connectToDeviceOrExit()
more than once?
On Tue, Jun 3, 2014 at 9:41 AM, haradreborn notifications@github.com wrote:
culebra print is a part of fy own script, that call os.system('python satest.py > _LOGS/launch_log' + start + '.txt') here is my unlock part: ```def unlock(): device, serialno = ViewClient.connectToDeviceOrExit(verbose=False) print("UNLOCK: init device") device.wake() print("UNLOCK: press home") device.press('KEYCODE_HOME') find views
vc = ViewClient(*ViewClient.connectToDeviceOrExit()) apps = vc.findViewWithText('Apps') start = vc.findViewById('com.android.keyguard:id/keyguard_unlock_view_help_text') stop = vc.findViewById('com.android.keyguard:id/keyguard_message_area')
unlock
if (apps is None): device.drag((start.getX(), start.getY()), (stop.getX(), stop.getY()), 500) print ("UNLOCK: drug from object - " + start.tinyStr() + " to - " + stop.tinyStr()) else: print("UNLOCK: device already unlocked, button apps exists - " + apps.tinyStr())
press home
print("UNLOCK: press home") device.press('KEYCODE_HOME') if (verify_view('Apps', 0.1, 4) == True): STATE.append(1) return True else: STATE.append(2) return False```
As I understand, adb can cause that issue, because when it freezes, it starts to create a lot of processes, so I can see 50+ procesess with 'pidof adb', and 5037 port become ESTABLISHMENT. I solved this by 'adb kill/start-server' on each test run.
— Reply to this email directly or view it on GitHub https://github.com/dtmilano/AndroidViewClient/issues/81#issuecomment-44965375 .
Have you read my blog ? http://dtmilano.blogspot.com android junit tests ui linux cult thin clients
I move connectToDeviceOrExit()
to the separate method, and test it again - an issue is still there, but without an xml error at this time. I have an 'ERROR: timed out' and 'Alarm clock ' messages
start: 1401863215000
ERROR: timed out
sleep
Alarm clock
parser: 1401863215000
And also I got another error:
start: 1401884242000
Traceback (most recent call last):
File "satest.py", line 58, in <module>
simple.error_watcher()
File "/home/adminuser/lampstack-5.4.26-0/apache2/htdocs/ANDROID/simple.py", line 200, in error_watcher
device.takeSnapshot().save('_SHOTS/scr' + logname + '.png', 'PNG')
File "/usr/local/lib/python2.7/dist-packages/androidviewclient-6.0.0-py2.7.egg/com/dtmilano/android/adb/adbclient.py", line 416, in takeSnapshot
received = self.__receive(size)
File "/usr/local/lib/python2.7/dist-packages/androidviewclient-6.0.0-py2.7.egg/com/dtmilano/android/adb/adbclient.py", line 172, in __receive
chunk = self.socket.recv(min((nob - nr), 4096))
socket.timeout: timed out
sleep
Here is my error_watcher method:
def error_watcher():
print ("ERROR: capturing screenshot")
if (verify_view('Unable to connect to the network. Check your network settings and try again.', 0, 2) == True):
print ("ERROR: Unable to connect to the network")
device.takeSnapshot().save('_SHOTS/scr' + logname + '.png', 'PNG')
ISSUE.append(3)
elif (verify_view('Network unavailable', 0, 2) == True):
print ("ERROR: Unable to resolve host")
device.takeSnapshot().save('_SHOTS/scr' + logname + '.png', 'PNG')
ISSUE.append(4)
else:
print ("ERROR: UNKNOWN")
device.takeSnapshot().save('_SHOTS/scr' + logname + '.png', 'PNG')
ISSUE.append(2)
and verify_view:
def verify_view(view, delay, it):
start = datetime.datetime.now()
s = 0
for counter in range(1,it):
vc = ViewClient(*ViewClient.connectToDeviceOrExit())
view_object = vc.findViewWithText(view)
if (view_object is None):
print("VERIFY: view - " + view + " not found")
s = 2
time.sleep(delay)
else:
print("VERIFY: view - " + view + " exists")
s = 1
break
stop = datetime.datetime.now()
global rest
rest = stop - start
print("VERIFY: verification time is: " + str(rest) + " seconds")
if (s == 0):
print("VERIFY: TEST ERROR, debug param 's' == " + str(s))
return False
if (s == 1):
print("VERIFY: verification finished successfully, text - '" + view + "' was found")
return True
else:
print("VERIFY: verification failed, there are no text - '" + view + "'")
return False
Hi, I have a script with infinity loop that runs simple 5 steps test with AVC. Every time after an hour or two it stops with an error: