I'm trying to run this scrip for monkeyrunner that I found in this post:
#! /usr/bin/env monkeyrunner
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
from random import randint
print "get device"
device = MonkeyRunner.waitForConnection()
package = 'my.package.name'
activity = 'my.package.name.MyActivity'
runComponent = package + '/' + activity
device.startActivity(component=runComponent)
#use commands like device.touch and device.drag to simulate a navigation and open my activity
for i in range(1, 1000):
#here i go emulate only simple touchs, but i can emulate swiper keyevents and more... :D
print "start touch $i"
device.touch(randint(0, 1000), randint(0, 800), 'DOWN_AND_UP')
print "end touch $i"
print "end monkey test"
It runs but it seems like the line inside the for loop is executed only once.
device.touch(randint(0, 1000), randint(0, 800), 'DOWN_AND_UP')
nay ideas? I also would like to perform different types of clicks and actions, like the command line does adb shell monkey -p my.package.name -v 500.
I created the script because I need to make sure that some Activities are tested. Right, if I run the command like posted above, the monkey test gets into one single activity and never goes back.
Aucun commentaire:
Enregistrer un commentaire