MonkeyRunner an API for writing programs that control an android device or emulator for automation testing. An intro to Monkey testing too. In next slide we will be sharing how to run the tool with an example too.
- 1. Author: Syeda Fatima Waseem
2. What is MonkeyRunner??? It is a tool which provides an API for writing programs that control an android device or emulator It is a python based test tool, used to run python scripts for testing android applications It uses Jython, an implementation of python that uses the Java programming language 3. Why MonkeyRunner is Used??? It is primarily designed to test applications and devices at the functional level and for running unit/functional test suites It can be used to test an application against a random clicks on the application 4. What you can do with MonkeyRunner??? You can write python programs to test the applications on one or more devices and/or emulators You can do following things with monkeyrunner: Installs an application or test package Runs an application Send keystrokes or touch events to it Take screen shots of the user interface Store screen shots on your workstation 5. Features of MonkeyRunner 1. Multiple device control: MonkeyRunner API can apply one or more test suites across multiple devices or emulatorsYou can physically attach all the devices or start up all the emulators (or both) at once, connect to each one in turn programmatically, and then run one or more tests 6. Features of MonkeyRunner 2. Functional Testing: MonkeyRunner can run an automated start-to-finish test of and Android application You can provide input values with keystrokes or touch events, and view the results as screenshots 7. Features of MonkeyRunner 3. Regression Testing: MonkeyRunner can test application stability by running an application and comparing its output screenshots to a set of screenshots that are known to be correct 8. Features of MonkeyRunner 4. Extensible Automation: As MonkeyRunner is an API toolkit, you can develop an entire system of Python-based modules and programs for controlling Android devices 9. Modules of MonkeyRunner 1. MonkeyRunner: A class of utility methods for monkeyrunner programs This class provides a method for connecting monkeyrunner to a device or emulator2. MonkeyDevice: Represents a device or emulator This class provides methods for installing and uninstalling packages, starting an Activity, and sending keyboard or touch events to an application You also use this class to run test packages 10. Modules of MonkeyRunner 3. MonkeyImage: Represents a screen capture image This class provides methods for capturing screens, converting bitmap images to various formats, comparing two MonkeyImage objects, and writing an image to a file 11. MonkeyRunner Methods Method alert (string message, string title, string okTitle)Description Displays an alert dialog to the process running the current programchoice Displays a dialog with a list of choices (string message, iterable choices, string title) to the process running the current program help (string format)Displays the monkeyrunner API reference in a style similar to that of Python's pydoc tool 12. MonkeyRunner Methods MethodDescriptioninput Displays a dialog that accepts input (string message, string initialValue, string title, string okTitle, string cancelTitle) sleep (float seconds)Pauses the current program for the specified number of secondswaitForConnection float timeout, string deviceId)Tries to make a connection between the monkeyrunner backend and the specified device or emulator 13. Monkey Testing 14. What is Monkey Testing??? Word Monkey is used to refer a fully automated testing tool Monkey testing is a random testing performed by automated testing tools and has no fixed perspective for testing , so it performs mouse clicks on the screen or keystrokes on the keyboard randomly Testing is done randomly for judging that, accessing different functionalities is in coherence or is it showing any abnormality 15. Why Monkey term is used??? We call them Monkey because it is widely believed that if we allow six monkeys to pound on six typewriters at random, for a million years, they will recreate all the works of Isaac Asimov The name 'monkey' comes from the adage that a thousand monkeys at a thousand typewriters will eventually type out the entire works of Shakespeare 16. Types of Monkey Test Monkey Testing Dumb Monkey TestingSmart Monkey Testing 17. 1. Dumb Monkey Testing Initial and the lowest level of testing service is called Dumb Monkey Testing Dumb monkey knows nothing about the software being tested, it just clicks or type randomly They are easy to write and can find serious, crashing bugs 18. 2. Smart Monkey Testing Having some experience and improved testing skills the Dumb Monkey reaches the next stage in evolution: Semi-Smart Monkey Testing Different levels of IQ in Semi-Smart Monkey testing: In low IQ testing, inputs would be generated independently i.e. each input is considered independent of the other inputs In high IQ monkey testing, the correlation (e.g., the covariance) between input distribution is taken into account 19. Dumb Monkey Testing Advantages Find bugs even at the early stage of the development which saves testing time later and corrective actions are possible at the earliest possible time They are easy to write It can test continuously for several days, unless it encounters bugs or crash Will not find many bugs, but when it finally finds the bugs, it is most likely the major ones, hangs and crashes Easy to set up; can be used in any application Costs less than smart monkey 20. Dumb Monkey Testing Disadvantages It is capable only of limited and basic tests Educating the dumb monkey further would make it less dumb, but would mean additional cost 21. Smart Monkey Testing Advantages & Disadvantages Advantages: Capable of finding a significant number of bugs, if properly set up, with an accurate state model Valuable tool for load and stress testingDisadvantages: Costs more than the dumb monkey Capability depends on the state model installed, the more the state models, the more expensive will be the smart monkey 22. firstname.lastname@example.org+92-42-35782346 www.Twitter.com/SwaamTech www.FaceBook.com/SwaamTech