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
2
votes
1 answer

random number generator monkey test diehard

I have a question about Diehard Testtool. My Random Number Generator doesn't passed monkey test (DNA Test). One p-value was 0. Is this critical? How can I interpret the result? Thank you in advance!
sewa80
  • 21
  • 2
2
votes
1 answer

Android Studio and Monkeyrunner

I am using AS version 0.5.4 on a Mac. Per bash profile PATH points to export PATH=$PATH:/Applications/Android\ Studio.app/sdk/platform-tools/ When I cd to that directory, I can't find monkeyrunner. I also tried updating AS but that didn't help.…
user3277846
  • 1,019
  • 1
  • 10
  • 15
2
votes
0 answers

Unable to perform click to next page using monkey runner

I have an application with nested pages in it. I wrote a script for monkeyrunner . My script is able to start applications and access object of the page. Now when I perform touch to one of my buttons it load the next page. Now I am not able to…
2
votes
2 answers

Documentation on Eclipse Monkey

I'm looking for some documentation on "eclipse monkey" features. What variables are predefined, what methods do these objects have and so on... You can only get so far by tweaking the examples.
Stroboskop
  • 4,327
  • 5
  • 35
  • 52
1
vote
1 answer

Can i safely dispatch touch events to main activity by calling onTouch() method from another thread?

Please tell me if this approach is safe or what i can use instead of a plain Thread to safely dispatch Touch Events to my activity, for the purpose of testing the entire flow witch triggers from that onTouch() method. //this is the thread which…
1
vote
2 answers

Start monkeyrunner script on multiple devices

I have a script that should be run on two devices at same time, this two devices are connected to one pc. How can I run the script on both devices at the same time ? is there some option like -s "SERIAL_NUMBER" , or something l
Lukap
  • 31,523
  • 64
  • 157
  • 244
1
vote
1 answer

Why doesn't Monkey generate the same sequence of events?

I'm running stress tests on Android using Monkey to generate the workload. For the type of analysis I have to do, I need to generate the same sequence of events for each experiment. So, in every experiment, I always use the adb shell monkey command…
Luigi
  • 181
  • 3
  • 15
1
vote
1 answer

python tkinter canvas moving an image using multiple condition based on selected combobox values

Please see the image for your referenceHello I am making my tkinter graduation project, I am new to python. I want to move the specified chess piece inside a risk matrix likelihood and impact matrix based on the selected combobox values from 1 to 5.…
henoker
  • 99
  • 8
1
vote
0 answers

cannot execute php on monkey server

i am running linux Mint Mate 19.3 32 bits on my desktop I installed monkey server 1.6.9 and php7.2-fpm to run php-based web sites made by my students. Unfortunaty the code in index.php via 127.0.0.1:2001 is not executed and…
tran88
  • 11
  • 2
1
vote
1 answer

ADB to Launch android browser with given url

I am trying to send a commend via ADB to launch different browsers with a given URL. I only know the package names of the browsers so I used: adb shell monkey -p com.android.chrome -c android.intent.category.LAUNCHER 1 This way I could open the…
Oron Werner
  • 1,211
  • 1
  • 7
  • 14
1
vote
1 answer

android - running monkeyrunner over wifi on a real device

I have a build server and I would like to run a monkeyrunner script on many devices simultaneously once the build is ready. I found here a way to connect to the devices over tcp so I connected to a device and successfuly ran "adb monkey", "adb…
nir
  • 161
  • 2
  • 7
1
vote
0 answers

How to prevent the monkey from clicking on the title bar on Android phone emulator?

I run the monkey on Android emulator from Windows command line with the following command: adb shell monkey -p --monitor-native-crashes --kill-process-after-error --pct-touch 100 1000000000 but it clicks not only on the app, but…
Alexey Starinsky
  • 3,699
  • 3
  • 21
  • 57
1
vote
0 answers

How to change location while using Monkey while testing app?

How to test with different location as I am using latitude and longitude functionality in my app? My code for monkey is monkey -s 1009 1000000 --throttle 10000 --pct-syskeys 0 --ignore-crashes --ignore-security-exceptions --ignore-timeouts I have to…
Nappa
  • 131
  • 1
  • 9
1
vote
0 answers

java.lang.IllegalStateException: focus search returned a view that wasn't able to take focus

In Android 7.0,When I run adb shell monkey -p com.android.contacts --throttle 300 -v 10000000, get log show java.lang.IllegalStateException: focus search returned a view that wasn't able to take focus! --------- beginning of crash 01-19 15:46:05.169…
ShuRan.Ning
  • 11
  • 1
  • 3
1
vote
0 answers

monkey test " Sending Flip keyboardOpen=false" cause IOException

adb shell monkey -p com.eisoo.anycontent --kill-process-after-error --throttle 300 -s 600 -v -v -v 1000 > .\log.txt After it finished in the log file I found many IOException like bellow: "Sleeping for 300 milliseconds :Sending Flip…
dy20082250
  • 11
  • 4