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
0
votes
2 answers

PyCharm - How to create a Run/Debug Configuration that executes a .bat file which uses a Python script as a parameter?

I want to create a new Run/Debug Configuration which executes a .bat file that accepts a Python script as a parameter. The program I want to execute is MonkeyRunner (a tool part of Android SDK) which is located in the…
talha06
  • 6,206
  • 21
  • 92
  • 147
0
votes
1 answer

Android - InputStream's buffer size changes? This should be impossible

I have this, where mmInputStream is an InputStream of a Bluetooth connection: int bytes; boolean hasData; while (!isInterrupted()){ byte[] buffer = new byte[1024]; hasData = false; try { bytes =…
MikeHelland
  • 1,151
  • 1
  • 7
  • 17
0
votes
0 answers

Why does this Monkey test log "null"?

When I run this instruction in a Android TV adb shell monkey --ignore-crashes --ignore-timeouts --ignore-native-crashes --pct-touch 0 -v -v -v --throttle 50 -s 30 500000 >/data/local/tmp/monkeylog/test_3v_500k.txt…
0
votes
0 answers

I want to evaluate Android stability with Monkey test. Is there any suggestion about execution time?

We are working on customizing Android and need evaluate Android system stability. Plan to use 9 Android phones and run Monkey once a day. However, the execution time for each day and testing how many days is hard to determine by us. Is there any…
Lei Yang
  • 1
  • 1
0
votes
1 answer

Adb monkey testing fall out to other packages

I'm using the following command to test my android app pb = new ProcessBuilder("adb","-s", deviceId,"shell", "monkey -p" + packageName + " -v 5000"); My problem is that when the adb monkey start to test then it open also system settings, audio…
nestorasg
  • 119
  • 2
  • 13
0
votes
1 answer

Get exit status of Android Monkey tool in Jenkins pipline

I'm running test on an Android device using the monkey tool. The problem is the Jenkins pipeline passes as SUCCESS even when monkey crashes the app. Is there a way to get the exit code from sh or the monkey tool and mark the stage as a FAILURE?…
theJosh
  • 2,894
  • 1
  • 28
  • 50
0
votes
0 answers

How do I force stop a monkey automation?

I've followed this tutorial by letting it do 100,000 events. Now, I don't know how do I stop this thing aside from restarting the emulator. Thank you.
Sid Go
  • 2,041
  • 3
  • 16
  • 29
0
votes
1 answer

Android: Monkey vs Monkeyrunner for event simulation

I want to simulate events generated by a typical user to collect network traffic traces using the network monitor. I went through the Info. given in…
Vikash Balasubramanian
  • 2,921
  • 3
  • 33
  • 74
0
votes
1 answer

meaning of "1" in monkey command

I recently read a book about android.In that book for running the monkey script the bellow command introduced: adb shell monkey -f myscript.txt 1 I searched this command and find out what f meaning. but when I searched about "1", I can not find…
jody abbot
  • 303
  • 2
  • 15
0
votes
1 answer

monkey test java.io.filenotfoundexception

java.io.FileNotFoundException: /data/data/com.forward.test/files/1458096313000.stacktrace: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:416) at…
0
votes
1 answer

Android : monkey spends a disproportionate amount of events on settings activity

I am new to using monkey on Android and from trying out a few examples I see it's spending most of its events on settings activity. It didn't matter which activity I started my tests from, it ended up just trying to make changes to my settings…
LostPuppy
  • 2,471
  • 4
  • 23
  • 34
0
votes
1 answer

run monkey_recorder.py error: mismatched input 'monkey_recorder' expecting NEWLINE

When I tried to use monkeyrunner command to run recorder, I got the error: mismatched input 'monkey_recorder' expecting NEWLINE. Here is screenshot of my command. enter image description here
0
votes
2 answers

How to get tombstone file generated with guarantee when killing android process

I have to simulate the situation where existing android process will be killed and as a result tombstone file will be generated immediately. I use following command sequence in order to achieve that: adb shell monkey -p com.google.android.apps.maps…
Viktor Malyi
  • 2,298
  • 2
  • 23
  • 40
0
votes
3 answers

Prevent apps from being launched by monkey test

I'm currently running a continuous monkey test to test the stability of a device, and I've noticed that when using monkey, it's able to change settings, including developer options and whatnot. Is there any way to prevent it from being launched,…
yeah568
  • 108
  • 1
  • 10
0
votes
1 answer

Android -- How to detect if Monkey Tool has finished working?

I'm developing an application which is basically about performing stress/functional tests for the devices that are being produced. The application should wait until Monkey Tool finishes working so that it can produce a .log file and inform about the…
Burak Day
  • 907
  • 14
  • 28