Sunday, July 30, 2017

Basic Use of Monkey Command


Before we proceed to the topic, what is Monkey and its commands?
The Monkey is a program that runs on emulator or device and generates random user events such as clicks, touches or gestures, as well as a number of system-level events.
We can use the Monkey to stress-test an applications, in a random yet repeatable manner.

Overview



Monkey is a command-line tool that that we can run on any emulator instance or on a device. It sends a pseudo-random stream of user events into the system, which acts as a stress test on the application software.
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 we 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 application crashes or receives any sort of unhandled exception, the Monkey will stop and report the error.
  • If application generates an application not responding error, the Monkey will stop and report the error.
Depending on the verbosity level we have selected, we will also see reports on the progress of the Monkey and the events being generated.

Basic Use of the Monkey



We can launch the Monkey using a command line on development machine or from a script. Because the Monkey runs in the emulator/device environment, we must launch it from a shell in that environment. we 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 target.
Here is a more typical command line, which will launch application and send 500 pseudo-random events to it:
$ adb shell monkey -p your.package.name -v 500



Source:
- https://developer.android.com/studio/test/monkey.html

Run Android Apps in Chrome Browser in Windows, OS X and Linux

Unofficially, now it is possible to run any Android app in Chrome browser on Windows, Mac and Linux!! Here is how you can make it w...