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
3
votes
3 answers

Switch the screen mode with MonkeyRunner?

How can I use MonkeyRunner to switch the screen mode(Portrait mode and Landscape mode)?
Martin
  • 57
  • 4
3
votes
1 answer

Android UI testing: Monkey stuck in just a couple of Activities

I've been trying to use Monkey to stress test the UI of my application. What I've noticed is that the random key strokes are not able to traverse all the Activities of my application. It instead just keeps looping between a few of them. Is there any…
Prashast
  • 5,645
  • 3
  • 30
  • 31
3
votes
2 answers

How to prevent entering settings when using Monkey Test

I have a monkey test with my application in android device(LG G4). The command is adb shell monkey -p {package name} -v 2000 But it may accidentally enter settings and change my device's default value. How to prevent it ?
pop
  • 105
  • 1
  • 7
3
votes
0 answers

android gradle monkeyTalk build issue

I'm using monkeyTalk in order to get write test by this demo. I`m using AndroidAnnotations 2.7.1 and i faced an issue like this. Note: Generating source file:com.activity.SaveFileDialogActivity_ Note: Time measurements: [Whole Processing = 517…
nAkhmedov
  • 3,522
  • 4
  • 37
  • 72
3
votes
1 answer

Android monkey testing

Iam testing my Android Application using monkey. So, i have used the following command... adb shell monkey -p mypackage_name -v 500 I got the meaning of this command and its working fine but at last iam getting the feedback as follows Events…
user3297196
  • 47
  • 2
  • 11
2
votes
1 answer

Visual component become invisible in design mode and cannot get them back in Fire Monkey

I am using a TScaledLayout as a background and after I load the project a few times ALL visual components become invisible, they are there and will compile and run fine but I cannot get them to become visible again. Has happened 4 times now and have…
user932013
  • 21
  • 1
2
votes
0 answers

Android monkeyrunner test calls onClick handler twice

I am experiencing funny behavior of monkey. When app shows AlertDialog with two buttons, my onClick handler sometimes called twice. This does not happen when I press the button manually, only when using monkey. Here is my activity…
lstipakov
  • 3,138
  • 5
  • 31
  • 46
2
votes
1 answer

Using adb monkey seed across different devices/emulators

I am working on automating monkey testing for Android apps. My question is, if I obtain the seed when monkey causes a crash, what are the requirements to use the seed to reproduce the crash again across devices? Like Android os version, exact…
JRowan
  • 6,824
  • 8
  • 40
  • 59
2
votes
0 answers

crash in security framework with call SecItemCopyMatching

we have a bug run in monkey, the call back stack like this: Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libsystem_kernel.dylib 0x000000018b853224 mach_msg_trap + 8 1 libsystem_kernel.dylib …
Archerlly
  • 193
  • 10
2
votes
1 answer

Can you start Android monkey from app?

I can start the monkey on Android with an adb shell using the following command: adb shell monkey --ignore-crashes -p com.teslacoilsw.launcher 200 -v 1 However, I would like to know if it's possible to start the monkey from an Android app. I tried…
Shane Smiskol
  • 952
  • 1
  • 11
  • 38
2
votes
1 answer

How to run monkey testing ONLY in application?

How to run monkey testing ONLY in testing application? How can I set border for monkey testing. I don't want that it touches any button out of my testing application.
Ponomarenko Oleh
  • 732
  • 2
  • 12
  • 25
2
votes
1 answer

Trouble getting tcpdump to capture data from android

I'm trying to write a bash script in Ubuntu to install an app on an android emulator, send random commands to the app using 'monkey' and capture all the data with tcpdump. Code: #!/bin/bash #store all apks files in array shopt -s…
yalpsid eman
  • 3,064
  • 6
  • 45
  • 71
2
votes
2 answers

Is Monkey really meaningful?

As part of a new Android application, we are setting up a full Continuous Integration (with Jenkins, but it doesn't matter). We have automatized JUnits and UI tests as of now, and we were thinking about adding Monkey testing after each build, just…
Sir4ur0n
  • 1,753
  • 1
  • 13
  • 24
2
votes
0 answers

java.util.concurrent.RejectedExecutionException: Task android.os.AsyncTask$3@3fb43c24

I test my program using monkey and appeared the following error, but I did not use 'AsyncTask', does anybody can help me solve this problem. Short Msg: java.util.concurrent.RejectedExecutionException Long Msg:…
Bowen
  • 21
  • 1
2
votes
2 answers

Example for using monkey command with almost all options in android

I started to learn adb shell monkey command for testing an Android app through develoers.android.com website. However, I was able to figure out example for options v and s (seed). I need to use other options to control the touch inputs to the app…
swagatika
  • 31
  • 1
  • 1
  • 2
1 2
3
9 10