androidandroid-testingmonkeyrunnermonkey

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 https://developer.android.com/studio/test/monkeyrunner/index.html and https://developer.android.com/studio/test/monkey.html

And i can see that monkey is used to generate a random distribution of events using command line options, whereas monkeyrunner is used to generate specific events using Jython API.

Can anyone suggest which of the tools would be a better fit to simulate a typical user session on an application for the purpose of collecting network traces?

Any suggestions to use a better tool than these two suitable for this task is also welcome.


Solution

  • There's still another option which is AndroidViewClient/culebra.

    monkey generates random events and you have to decide what events to send using monkeyrunner, whereas culebra concertina mode instead of sending pseudo-random events, analyzes the content of the screen and randomly selects a suitable event or action for the also randomly selected target, normally a View.

    For example, if the randomly selected view is an EditText, culebra enters some random text. However if the EditText turns to be a password, it sends random passwords, that is instead of just entering a normal sentence it selected sample passwords from a list like the infamous "querty". Furthermore, if it detects the EditText is expecting an email address, by inspecting the id, the hint or anything else that may suggest that, it sends random email addresses like user@example.com. Of course, other Views, receive other treatment, like Buttons being clicked, Scrollables being scrolled, etc.

    The best part is that you can edit concertina.py to suit your needs (yes, it should support plugins...).

    More detailed information can be found at http://dtmilano.blogspot.ca/2015/08/culebra-concertina-mode.html and https://github.com/dtmilano/AndroidViewClient/wiki/culebra.