Android application stress testing with monkey tool

Before we start, if you want to know what is "stress testing" please check this article on Wikipedia. If you what to know what is "Monkey tool" please check this documentation - Monkey. Monkey tool is a part of android platform tools, to install them, please visit PlatformTools and ADB documentation.

In a case of any questions about installation or usage, feel free to leave a comment via Disqus. In this post, I would like to show how you can easily perform automated stress testing for any beta application on your device.

Monkey tool

Monkey is a command line ADB tool with several options to adjust. You will need to know a package name of your android application.

The command itself looks like that

adb shell monkey -p -v --pct-syskeys 0 3000

The is a package name of Sidekix: Walking Navigation

What is does.

  • It will automatically execute a script command against the main activity of Sidekix application.
  • The script will start executing different events on your device such as touches, swipes etc.
  • The script will print all events to the log. In a case of any crash - you will see an error StackTrace in the logs.


It has many parameters to adjust and here I would like to focus on the most important things.

  • p - This parameter allows you to specify an application package name.
  • v - Verbose mode. It will let you see the detailed log of the script execution. —pct-syskeys 0 - Percentage of system keys events. By default all events sent to your device are random and a chance that monkey will start smashing your system keys is very big. Usually, you will want to minimise an amount of those events because it can turn volume to the maximum level and turn your music player on after.
  • 3000 - This value in the end specifies and an amount of events to execute. Don’t put too many numbers here because it is tricky to stop this script and it will continue running even if you will unplug it.


In parallel with Monkey, I am using screenrecord tool to capture a video from the device screen.

adb shell screenrecord /sdcard/monkey_test.mp4

It can be very helpful because it may help you or developer to reproduce the problem. For better understanding, you can enable touches highlighting in the developer settings of your device. All monkey events are executed against the device which means that if you have this option enabled, you will be able to see all performed actions on the video.

How to crash apps

It is a part of the best practice for the developer to use a Monkey tool. However, it is hard to cover all corner cases. In the video below I turned internet connection off which sometimes may cause unexpected results.

YouTube Video

Click to watch

No internet connection, location service turned off, horizontal rotation, etc. Many of those circumstances may cause an app to crash. That is the most helpful part of the Monkey tool - you can quickly play around those conditions by stress testing your app with Monkey.

What to do next

Always report an app crash to the developer. In most cases, it is enough for them to identify a problem and fix it.

If you think that they may need an additional information.

  • capture a video
  • save an error traceback or full monkey log
  • capture a screenshot of a crash if you don’t have a video
  • write down your pre-conditions (device name, android version, application version, etc..)
  • try to reproduce found crash manually and describe steps to reproduce

By the way - here is an example of Monkey tool log with a StackTrace.

How to reproduce

Well, here is where the challenge comes in. Usually, it is tricky to figure out what your monkey did with the app to make it crash. That is why video record can be very helpful. Depending on the difficulty of reproducing you can give a priority to the found issue. As harder it to reproduce as lower the priority is. Why? Because it means that if you cannot reproduce it, other users will have the same chance for this crash to happen.

What this error means for end users

I wasn’t able to reproduce this particular crash and most probably not that many users will see this app crashing because of my case. But there is no guaranty that this issue wouldn’t rise after several updates as a massive critical issue because of some code change. Fixing those kinds of issues asap is always a good practice :)

I would also like to say that you should give Sidekix: Walking Navigation a try. It has a nice design and I got a good user experience during my tests. Don’t forget to report your feedback! Cheers!