Recent from talks
Nothing was collected or created yet.
Monkey testing
View on WikipediaIn software testing, monkey testing is a technique where the user tests the application or system by providing random inputs and checking the behavior, or seeing whether the application or system will crash. Monkey testing is usually implemented as random, automated unit tests.
While the source of the name "monkey" is uncertain, it is believed by some that the name has to do with the infinite monkey theorem,[1] which states that a monkey hitting keys at random on a typewriter keyboard for an infinite amount of time will almost surely type a given text, such as the complete works of William Shakespeare. Some others believe that the name comes from the classic Mac OS application "The Monkey" developed by Steve Capps prior to 1983. It used journaling hooks to feed random events into Mac programs, and was used to test for bugs in MacPaint.[2]
Monkey Testing is also included in Android Studio as part of the standard testing tools for stress testing.[3]
Types of monkey testing
[edit]Monkey testing can be categorized into smart monkey tests or dumb monkey tests.
Smart monkey tests
[edit]Smart monkeys are usually identified by the following characteristics:[4]
- Have a brief idea about the application or system
- Know its own location, where it can go and where it has been
- Know its own capability and the system's capability
- Focus to break the system
- Report bugs they found
Some smart monkeys are also referred to as brilliant monkeys,[citation needed] which perform testing as per user's behavior and can estimate the probability of certain bugs.
Dumb monkey tests
[edit]Dumb monkeys, also known as "ignorant monkeys", are usually identified by the following characteristics:[citation needed]
- Have no knowledge about the application or system
- Don't know if their input or behavior is valid or invalid
- Don't know their or the system's capabilities, nor the flow of the application
- Can find fewer bugs than smart monkeys, but can also find important bugs that are hard to catch by smart monkeys
Advantages and disadvantages
[edit]Advantages
[edit]Monkey testing is an effective way to identify some out-of-the-box errors. Since the scenarios tested are usually ad-hoc, monkey testing can also be a good way to perform load and stress testing. The intrinsic randomness of monkey testing also makes it a good way to find major bugs that can break the entire system. The setup of monkey testing is easy, therefore good for any application. Smart monkeys, if properly set up with an accurate state model, can be really good at finding various kinds of bugs.
Disadvantages
[edit]The randomness of monkey testing often makes the bugs found difficult or impossible to reproduce. Unexpected bugs found by monkey testing can also be challenging and time consuming to analyze. In some systems, monkey testing can go on for a long time before finding a bug. For smart monkeys, the ability highly depends on the state model provided, and developing a good state model can be expensive.[1]
Similar techniques and distinctions
[edit]While monkey testing is sometimes treated the same as fuzz testing[5] and the two terms are usually used together,[6] some believe they are different by arguing that monkey testing is more about random actions while fuzz testing is more about random data input.[7] Monkey testing is also different from ad-hoc testing in that ad-hoc testing is performed without planning and documentation and the objective of ad-hoc testing is to divide the system randomly into subparts and check their functionality, which is not the case in monkey testing.
See also
[edit]References
[edit]- ^ a b "What is Monkey Testing | IT Training and Consulting – Exforsys". www.exforsys.com. 17 December 2011. Retrieved 2016-04-22.
- ^ "Folklore.org: Monkey Lives". www.folklore.org. Retrieved 2016-04-22.
- ^ "UI/Application Exerciser Monkey | Android Developers". developer.android.com. Retrieved 2016-04-25.
- ^ Patton, Ron (2001). "Random Testing: Monkeys and Gorillas". Software testing. Indianapolis, Ind: Sams. ISBN 978-0-672-31983-9.
- ^ Brummayer, Robert; Lonsing, Florian; Biere, Armin (2010-07-11). Strichman, Ofer; Szeider, Stefan (eds.). Automated Testing and Debugging of SAT and QBF Solvers. Lecture Notes in Computer Science. Springer Berlin Heidelberg. pp. 44–57. CiteSeerX 10.1.1.365.777. doi:10.1007/978-3-642-14186-7_6. ISBN 9783642141850.
- ^ "Fuzz Testing in Delphi - DelphiTools". www.delphitools.info. Retrieved 2016-04-22.
- ^ "Difference between "fuzz testing" and "monkey test"". stackoverflow.com. Retrieved 2016-04-22.
Monkey testing
View on GrokipediaOverview
Definition and Purpose
Monkey testing is an unstructured, randomized approach to software testing in which automated scripts or tools generate unpredictable inputs to simulate erratic user interactions with an application or system, aiming to expose defects that structured testing might overlook. This black-box technique involves randomly selecting from a wide array of inputs and actions, such as button presses or gestures, without any predetermined patterns or knowledge of the system's intended functionality.[6][7] The primary purpose of monkey testing is to uncover hidden bugs, crashes, and anomalous behaviors by mimicking chaotic real-world usage scenarios that deviate from expected norms, thereby assessing the software's stability and resilience without relying on formal test cases. By introducing randomness, it stresses the system to reveal vulnerabilities in edge cases or under unforeseen conditions, particularly in graphical user interfaces (GUIs) where user interactions are unpredictable. This method is especially valuable for exploratory purposes, allowing testers to probe for issues that scripted tests may not anticipate.[7][8] Central to monkey testing are the principles of chaos and stochastic input generation, which prioritize system robustness over controlled validation, often applied in early development stages to identify foundational flaws before more systematic testing occurs. The technique's random nature helps simulate the variability of human error or misuse, providing insights into how software handles stress without requiring deep domain knowledge.[8][9] The term "monkey testing" originates from the metaphorical image of a monkey randomly striking keys on a typewriter, symbolizing the haphazard and unintelligent input generation that characterizes the practice.[9]Historical Development
The concept of monkey testing traces its roots to the late 1970s, when the term was first introduced in Glenford J. Myers' seminal book The Art of Software Testing, describing a method of providing random inputs to software to uncover unexpected behaviors.[10] This idea emerged amid early efforts in software reliability and usability testing during the 1980s, where ad-hoc random input simulation began to gain traction as a way to stress-test graphical user interfaces. A pivotal early implementation occurred in 1983, when Apple developer Steve Capps created "The Monkey," a desk accessory program for the Macintosh that generated pseudo-random keystrokes to rigorously test applications like MacWrite and MacPaint, ensuring robustness under chaotic user interactions.[3] In the late 2000s, with the rise of mobile computing, the practice evolved from these manual and semi-automated origins into more structured tools. A key milestone came in 2008, when Google introduced the Android Monkey tool as a built-in utility within the Android SDK, designed to simulate random user events such as touches and gestures on mobile applications to identify crashes and stability issues.[5] This marked a shift toward automated random testing in industry-standard development environments, building on the foundational principles from earlier decades. In the 2010s, monkey testing transitioned further from manual ad-hoc approaches to fully automated frameworks, influenced by the adoption of agile methodologies and DevOps practices that emphasized continuous testing and rapid iteration.[11] By the 2020s, integration into continuous integration/continuous deployment (CI/CD) pipelines became widespread, allowing random input testing to run routinely as part of automated workflows to enhance software resilience.[12] Open-source communities contributed significantly to this evolution, extending tools like Selenium to implement monkey-like random actions for web application testing.[13] In the 2020s, monkey testing has further advanced with the integration of artificial intelligence, enabling 'smart' random testing that combines chaos with targeted exploration to achieve higher coverage in complex applications. As of 2025, tools like AI-enhanced Monkey testers are increasingly used in mobile app security and QA.[14]Types
Dumb Monkey Testing
Dumb monkey testing represents the most rudimentary variant of monkey testing, where inputs are generated entirely at random without any consideration for the application's workflow, user interface elements, or expected behaviors.[2] In this approach, the tester or automated process operates in complete ignorance of the software's functionality, producing actions such as arbitrary key presses, mouse clicks, swipes, or data entries at fixed or variable intervals, solely to simulate chaotic user interactions.[1] This unintelligent method ignores the current state of the application, making no distinction between valid or invalid inputs, which aligns with the core purpose of monkey testing to uncover defects through unpredictable chaos.[5] The mechanism of dumb monkey testing relies on simple automated scripts or tools that continuously inject random events into the system without requiring preconditions or logical sequencing. These scripts typically run for prolonged durations, such as several hours or days, to stress the application and reveal issues like crashes, memory leaks, or unhandled exceptions that might not surface under controlled conditions.[15] For instance, on a desktop application, the process might involve simulating rapid, haphazard keyboard inputs akin to "mashing" keys, while on mobile devices, it could generate erratic touch events across the screen without targeting specific buttons or fields.[16] This testing subtype is particularly suited for preliminary sanity checks on newly developed builds, where comprehensive test suites are not yet available, or for legacy systems lacking up-to-date documentation and structured testing frameworks.[5] It proves valuable in environments where the goal is to quickly identify gross stability flaws before investing in more sophisticated verification methods.[17]Smart Monkey Testing
Smart monkey testing enhances traditional monkey testing by integrating algorithmic intelligence to produce semi-random inputs that are informed by application models, user interface exploration, or prior crash data, thereby focusing efforts on more relevant interactions rather than unfettered randomness.[18] This approach leverages partial knowledge of the system's structure or behavior to generate test sequences that are both unpredictable and purposeful, improving fault detection efficiency in graphical user interfaces (GUIs).[9] Characteristics include adaptive action selection, state awareness to avoid infeasible paths, and prioritization of exploratory behaviors that mimic informed user actions while retaining an element of chaos.[19] The mechanism of smart monkey testing involves techniques such as finite state machines (FSMs) to model application states and navigate screens through logical transitions, ensuring inputs align with valid workflows.[18] Computer vision methods analyze screenshots for operable regions using saliency detection algorithms based on color, intensity, and texture features to identify clickable or interactive elements, confirming them via simulated events like taps or clicks.[20] Machine learning approaches, including reinforcement learning with deep Q-networks, enable agents to learn from interactions by assigning rewards for novel states or penalties for repetitions, thus prioritizing high-risk actions that could lead to crashes.[9] Hybrid strategies further blend these with random elements, appending unpredictable steps to model-driven sequences to uncover edge cases beyond scripted paths.[19] Smart monkey testing finds application in targeted validation of complex software, particularly web and mobile applications featuring dynamic UIs where random inputs alone produce high noise and low code coverage.[18] It excels in scenarios requiring efficient exploration of state spaces in resource-constrained environments, such as automated regression for consumer GUIs in appliances or games, reducing manual effort while increasing the likelihood of revealing latent defects.[20] Examples include frameworks that infer state models from runtime observations to replay crash-inducing sequences learned across sessions, systematically covering untested branches via meta-heuristics like ant colony optimization.[9] In mobile game testing, smart monkeys apply visual analysis to detect interactive zones in rendered scenes—such as buttons in selection menus or tappable tiles in rhythm games—generating coherent event chains that expose rendering or logic faults more effectively than blind randomness.[20]Brilliant Monkey Testing
Brilliant monkey testing is the most sophisticated variant of monkey testing, where testers with comprehensive domain knowledge and understanding of the application deliberately generate random inputs targeted at critical areas, simulating realistic user errors and complex interactions to uncover subtle defects and potential future issues.[1] This approach goes beyond automation by leveraging human expertise to focus on high-risk functionalities, such as input validation in sensitive workflows or edge cases in user paths, ensuring higher test coverage and relevance.[2] The mechanism involves informed randomization, where the tester identifies key system components and introduces unpredictable but purposeful actions, like invalid data entries in critical sequences or erratic behaviors in high-traffic modules, to stress-test for hidden bugs that structured methods might miss. It is particularly effective for mature applications with intricate workflows, where nuanced testing can reveal issues arising from real-world usage patterns. For example, in a banking app, a brilliant monkey might simulate a user entering conflicting transaction details in a multi-step process to expose concurrency flaws.[1] This subtype is best suited for final validation phases or security audits, complementing other testing strategies with its insightful, expertise-driven chaos.[2]Implementation
Tools and Automation
The primary tool for executing monkey testing on Android applications is the UI/Application Exerciser Monkey, a command-line utility that generates pseudo-random streams of user events such as clicks, touches, gestures, and system-level actions to stress-test apps for crashes, exceptions, and ANR errors.[21] This tool operates directly on Android devices or emulators via the Android Debug Bridge (ADB). For more advanced UI interactions that can be adapted to support smart monkey testing through custom scripting, the UI Automator framework provides APIs for external app testing, enabling scripted element interactions across Android versions.[22] Cross-platform automation is facilitated by extensions in tools like Appium, an open-source framework that simulates random user actions—such as taps, swipes, and text inputs—on both Android and iOS apps, allowing monkey testing without platform-specific rewrites. Open-source alternatives include the legacy MonkeyRunner, a deprecated Python-based API once used for functional testing that controls devices or emulators to send custom event sequences mimicking monkey behavior; modern alternatives like UI Automator are recommended instead.[23][22] Automation in monkey testing often integrates with scripting languages like Python, where UI Automator's APIs allow developers to write custom scripts for event injection, app installation, and screenshot capture, extending basic random generation to reproducible sequences.[22] Configuration options enhance control and repeatability, including event counts to limit the number of generated actions (e.g., 500 events), throttling to insert delays between events (e.g., 100ms intervals), and seed values to produce identical pseudo-random sequences for debugging.[21] Setup typically involves ADB commands on connected hardware; for instance, the basic invocationadb shell monkey -p com.example.app 500 targets a specific package and generates 500 random events in verbose mode.[21] The tool runs on both emulators, which simulate hardware for cost-effective local testing, and real devices, which provide accurate performance insights but require physical setup and battery management.[21]
As of 2025, cloud-based platforms enable scalable monkey testing across diverse device configurations. AWS Device Farm supports Android Monkey execution through custom test environments, allowing ADB-based runs on hundreds of real devices in parallel for comprehensive coverage.[24] Similarly, Firebase Test Lab integrates monkey-like testing via its Robo tool, which performs intelligent UI exploration with random actions, and accommodates custom Monkey scripts on virtual and physical devices for automated, distributed runs.[25]
