Questions tagged [monkey]

The Monkey is a program that runs on an Android emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. Monkey can be used to stress-test applications, in a random yet repeatable manner.

Overview

The Monkey is a command-line tool that that runs on any Android emulator instance or device. It sends a pseudo-random stream of user events into the system, which acts as a stress test on the application software you are developing.

The Monkey includes a number of options, but they break down into four primary categories:

Basic configuration options, such as setting the number of events to attempt. Operational constraints, such as restricting the test to a single package. Event types and frequencies. Debugging options. When the Monkey runs, it generates events and sends them to the system. It also watches the system under test and looks for three conditions, which it treats specially:

If you have constrained the Monkey to run in one or more specific packages, it watches for attempts to navigate to any other packages, and blocks them. If your application crashes or receives any sort of unhandled exception, the Monkey will stop and report the error. If your application generates an application not responding error, the Monkey will stop and report the error. Depending on the verbosity level you have selected, you will also see reports on the progress of the Monkey and the events being generated.

Basic Use of the Monkey

You can launch the Monkey using a command line on your development machine or from a script. Because the Monkey runs in the emulator/device environment, you must launch it from a shell in that environment. You can do this by prefacing adb shell to each command, or by entering the shell and entering Monkey commands directly.

The basic syntax is:

$ adb shell monkey [options] <event-count>

With no options specified, the Monkey will launch in a quiet (non-verbose) mode, and will send events to any (and all) packages installed on your target. Here is a more typical command line, which will launch your application and send 500 pseudo-random events to it:

$ adb shell monkey -p your.package.name -v 500
145 questions
1
vote
1 answer

android monkey script for multiple devices

Can some body can help me for to put android monkey test for multiple devices ? ->adb shell monkey -p com.example -v 500000 So here i have connected 10 devices in my PC. I wanted to run monkey test for all the device and capture the logs at the same…
1
vote
0 answers

How to solve the monkey issue like this?

We use monkey to verify the Contacts app, it shows fail log: 08-14 19:11:08.948 W/dalvikvm( 1142): threadid=2: spin on suspend #4 threadid=1 (pcf=0) 08-14 19:11:08.948 I/dalvikvm( 1142): "GC" daemon prio=5 tid=2 RUNNABLE 08-14 19:11:08.948…
alexunder
  • 2,793
  • 3
  • 15
  • 18
1
vote
2 answers

Is it possible to call Monkey tests from MonkeyRunner Script

At some point in my Monkeyrunner I want to launch random Monkey tests (The ones we can get through a command adb shell monkey -p my.package -v 500), So I added this line device.shell('monkey -p my.package -v 500') to my python script. But nothing…
moud
  • 729
  • 9
  • 19
1
vote
1 answer

The method "device.press" or "device.touch" of MonkeyRunner doesn't take effect

I want to use monkeyrunner to test my MainActivity,and I have edit a python file like below: from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice device = MonkeyRunner.waitForConnection(10) device.press('KEYCODE_DPAD_DOWN') …
Marshal Chen
  • 1,985
  • 4
  • 24
  • 35
1
vote
1 answer

Running specific commands in monkey not working

I read this page http://hariniachala.blogspot.com/2011/09/android-application-ui-testing-with.html and when I executed this code ./adb -d shell monkey -p package_name --port 1080 & ./adb -d forward tcp:1080 tcp:1080 telnet localhost 1080 I faced…
1
vote
1 answer

Kill a Ruby child process when another Ruby child process has completed

I'm trying to use Ruby to write a script to run monkey test on the Android app. I'm stuck with 1.8 Ruby and can't use spawn. See below code for detail. For some reasons, the logcat process will continue to run even after the monkey process has…
samxiao
  • 2,587
  • 5
  • 38
  • 59
1
vote
1 answer

testing a widget using Monkey

I am trying to run Monkey Test on a Widget for my application. The package for my app is com.myapp.mycompany.appstore and package for my widget is com.myapp.mycompany.appstore.appwidget I have intent category listed in my Manifest by still I get an…
VivekNR
  • 41
  • 4
1
vote
5 answers

Monkey Talk IDE doesn't record actions

I'm trying to use Monkey Talk for automation test. I installed it successfully. I run the sample app on Eclipse Juno then create a new Monkey script and record actions. The problem is Monkey IDE doesn't record my actions on device or emulator. I…
emeraldhieu
  • 9,380
  • 19
  • 81
  • 139
1
vote
1 answer

how to generate zoom/pinch gesture using Android Monkey tool?

Im trying to generate zoom/pinch gesture using the monkey of android , i have tried to use the Android API MotionEvent, but found it is hard to implement the zoom/pinch events. Can you help to tell me the correct method? Thanks.
Kevin
  • 11
  • 2
1
vote
1 answer

How to keep the android monkey tool running? i.e not limiting the number of events

How do I tell the Android Monkey Tool that it should run for an infinite amount of events?
Sojurn
  • 475
  • 6
  • 15
1
vote
2 answers

How does the monkey utility work on Android?

How does the monkey utility work on Android? Can we extend it somehow to send specific events instead of randomly generated ones?
dacongy
  • 2,504
  • 3
  • 30
  • 48
1
vote
4 answers

Killing android monkey process via adb only

I have a problem with a monkey process. Starting Monkey is easy, but how to stop it? I know how to stop any process, but I have no idea how the monkey process is called. DDMS shows a "?" process, and that's it, but I have to kill it with an adb…
user1393839
  • 11
  • 1
  • 2
1
vote
1 answer

Sending commands to adb from android activity

I find we can start monkey from workstation, by using the following command: adb shell monkey -p -v 500 But when i try to run monkey from emulator's terminal, like this: monkey -p -v 500 it was killed by android,…
0
votes
1 answer

How to test Android Application;s UI using Monkey

I am trying to test my Android app using Monkey. There they say use this command, $ adb shell monkey -p your.package.name -v 500 In my app, I have package name as travelceylon\client so if I give the command as: adb -e shell monkey -p…
andunslg
  • 781
  • 14
  • 38
0
votes
1 answer

android monkey restart apps automaticlly

I'm a little new in android monkey testing, so please forgive me if I'm going to ask some noob thing:) I'm lunching the monkey with monkey -throttle 10 -p com.mypackage.bla -v 5000 Everything okay, the monkey runs perfectly a lot of GUI event…
narancs
  • 5,234
  • 4
  • 41
  • 60