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

Whether it is possible to convert Monkey test log to Monkeyrunner testing

In monkey test, it can output test log, which contains all random events. I can use monkey runner to replay several events, including sending touch, sleep, switch. But, how to stimulate the track ball event in monkey runner?
csytang
  • 119
  • 3
  • 10
1
vote
1 answer

Monkey command to execute all the packages at a time

I am using following command to execute specific package: adb shell monkey -v -p com.google.android.apps.maps 500 adb shell monkey -p com.google.android.voicesearch 10 Q-1: But I want to execute all the packages in batch mode,can anyone please…
Elkay
  • 11
  • 1
  • 2
1
vote
0 answers

Android monkey test produced many activitiy instances which are in the INITIALIZING state

After running monkey test for a long time, one activity in my application produced a large number of instances which are in the INITIALIZING state. What could be the cause? How to solve this problem? This activity cannot be singleton.
xf1020
  • 43
  • 5
1
vote
3 answers

Access body of PUT or POST request using FastCGI in C

I'm facing some issues trying to get my body content in my monkey server. In fact, I don't really know how to access my data using fastcgi library functions. I'm sending with Postman a PUT request on…
kidz55
  • 333
  • 4
  • 26
1
vote
0 answers

test a plug-in components with monkey -c options but fail : no activities found for category

I am trying to test plug-in components with monkey.(It is an app A launch by another app B.it has a few functions with activities but have no launcher Activity.) As this app does not have any app icon because, there is no Intent.CATEGORY_LAUNCHER or…
Rphone
  • 11
  • 1
1
vote
0 answers

How do I open a monkey x .exe file in my python program without it closing immediately after?

I'm doing a school project and I've got a working logon script in python, however the rest of my code is in the language monkey X as it is easier to make games within that. I was wondering if it were possible to open the monkey x file without it…
1
vote
1 answer

How to add an Activity to blacklist in android monkey test?

In Android monkey test, I must exclude some activities that I don't want to test. I try to set ActivityLifecycleCallbacks on all Activities, and call finish() in onActivityCreated, onActivityStarted and onActivityResumed with some Activities I don't…
yuriel
  • 91
  • 1
  • 7
1
vote
1 answer

Monkey Patch private instance function in python 2 with calling old function

I want to monkey patch a function which private and part of a class but I also want to call the patched function. Example: class SomeClass: def __some_function(self, foo): return do_something() Now I want to write something like def…
ChristophLSA
  • 175
  • 3
  • 19
1
vote
0 answers

Android Jenkins CI with Auto-Restarting monkey testing

I have an unused mac mini, so I installed Jenkins on it, and I'm trying to configure it so that it is always running monkey tests on our latest Android build. I can't find a way to do that though. I've found the Android Emulator Plugin which allows…
spierce7
  • 14,797
  • 13
  • 65
  • 106
1
vote
1 answer

Admob - no test ad fill from ad server after stress testing with monkey

I was testing my android app using monkey and there might have been thousands of successive ad-requests while the test was on. The test went fine. Now, I no more get any fill for test ads. Logcat reads: No fill from ad sever. Failed to load ad:…
A.J.
  • 1,520
  • 17
  • 22
1
vote
0 answers

Simple test on a large range of devices (emulators)

I find that I often introduce subtle - but critical - bugs in my app on older versions of Android. For instance, who knew that this would crash android 4.1.2 true In the…
Markus
  • 2,526
  • 4
  • 28
  • 35
1
vote
1 answer

how to deal with jump to other app when test monkey with UIAutomation?

I'm testing my app with UIAutomation(monkey), and it may click a button and open safari, how can I do if I want to go back to my testing app ?
Sword King
  • 11
  • 2
1
vote
2 answers

How to execute adb shell monkey in specified time?

I want to run monkey in 10 minutes, But monkey only specify the COUNT. I tried the args --throttle, but it didn't work. For example, adb shell monkey --throttle 100 -p com.android.email -v 200 It execute finished in 5 seconds, but it should be at…
efei
  • 281
  • 1
  • 3
  • 14
1
vote
0 answers

How "monkey --port port" work?

I see that there is a option of monkey command in android adb shell. That is, "monkey --port port". i know it is a monkey client to receive server data, but how it work indeed? Is it related with com.android.command.monkey? adb shell monkey…
SanKeU
  • 11
  • 2
1
vote
2 answers

why android monkey has the permission to inject input events?

I know there is a permission check (pid/uid) when calling InputManager. the UID of monkey process is not equal with the UID of current activity. but why monkey process could inject event into the current window of activity?
bob
  • 59
  • 7