0

Hi All i am a new bie to use monkey script. Can anybody tell me what I have to do to test the whol application. ALL the click and specially how to wring log file for out put. I tried code so far but it couldnt test my whole app. I have two activities in my app one is main LEt suppose A and other is B which is setting screen. Can anybody tell me the script and what command I should put in my xxx.py to test for whole features. What I tried so far is.

! /usr/bin/env monkeyrunner

from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
from random import randint

print "get device"
device = MonkeyRunner.waitForConnection()
package = 'xx.xxxx.xxxx'
activity = 'xxx.exampleactivity
runComponent = package + '/' + activity
device.startActivity(component=runComponent)

#use commands like device.touch and device.drag to simulate a navigation and open my activity

#with your activity opened start your monkey test
print "start monkey test"
for i in range(1, 1000):
    #here i go emulate only simple touchs, but i can emulate swiper keyevents and more... :D
    device.touch(randint(0, 1000), randint(0, 800), 'DOWN_AND_UP')

print "end monkey test"
Community
  • 1
  • 1
Me Malik
  • 409
  • 2
  • 5
  • 13

1 Answers1

0

If your intention is to generate random events the tool you have to use is UI/Application Exerciser Monkey. Similar name but different functionality.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
  • what is the wrong in my above script?? is it incomplete??? I want to test each n every functionality with monkey runner. Kindly tell me what things is missing in my this script? or I have to add more key events or touch events? – Me Malik Jan 12 '14 at 11:37
  • You're sending random events, that's what `monkey` is for. Why reinvent the wheel? – Diego Torres Milano Jan 13 '14 at 16:37