In
software testing
Software testing is the act of checking whether software satisfies expectations.
Software testing can provide objective, independent information about the Quality (business), quality of software and the risk of its failure to a User (computin ...
, monkey testing is a technique where the user tests the application or system by providing
random
In common usage, randomness is the apparent or actual lack of definite pattern or predictability in information. A random sequence of events, symbols or steps often has no order and does not follow an intelligible pattern or combination. ...
inputs and checking the behavior, or seeing whether the application or system will crash. Monkey testing is usually implemented as random, automated
unit tests
Unit testing, component or module testing, is a form of software testing by which isolated source code is tested to validate expected behavior.
Unit testing describes tests that are run at the unit-level to contrast testing at the integration ...
.
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
The infinite monkey theorem states that a monkey hitting keys independently and at randomness, random on a typewriter keyboard for an infinity, infinite amount of time will almost surely type any given text, including the complete works of Willi ...
,
which states that a monkey hitting keys at
random
In common usage, randomness is the apparent or actual lack of definite pattern or predictability in information. A random sequence of events, symbols or steps often has no order and does not follow an intelligible pattern or combination. ...
on a
typewriter keyboard
A typewriter is a mechanical or electromechanical machine for typing characters. Typically, a typewriter has an array of keys, and each one causes a different single character to be produced on paper by striking an inked ribbon selectively a ...
for an infinite amount of time will
almost surely
In probability theory, an event is said to happen almost surely (sometimes abbreviated as a.s.) if it happens with probability 1 (with respect to the probability measure). In other words, the set of outcomes on which the event does not occur ha ...
type a given text, such as the complete works of
William Shakespeare
William Shakespeare ( 23 April 1564 – 23 April 1616) was an English playwright, poet and actor. He is widely regarded as the greatest writer in the English language and the world's pre-eminent dramatist. He is often called England's nation ...
. Some others believe that the name comes from the
classic Mac OS
Mac OS (originally System Software; retronym: Classic Mac OS) is the series of operating systems developed for the Mac (computer), Macintosh family of personal computers by Apple Computer, Inc. from 1984 to 2001, starting with System 1 and end ...
application "The Monkey" developed by
Steve Capps
Steve Capps is a pioneering American computer programmer and software engineer, who was one of the original designers of the Apple Macintosh computer and co-designers of the Finder in the 1980s. He also led development of the Apple Newton PDA an ...
prior to 1983. It used journaling hooks to feed random events into Mac programs, and was used to test for bugs in
MacPaint
MacPaint is a raster graphics editor developed by Apple Computer and released alongside the original Macintosh personal computer on January 24, 1984. It was sold bundled with its word processing counterpart, MacWrite, for US$195. MacPaint was n ...
.
Monkey Testing is also included in
Android Studio
Android Studio is the official integrated development environment (IDE) for Google's Android operating system, built on JetBrains' IntelliJ IDEA software and designed specifically for Android development. This is available for download on W ...
as part of the standard testing tools for
stress testing
Stress testing is a form of deliberately intense or thorough testing, used to determine the stability of a given system, critical infrastructure or entity. It involves testing beyond normal operational capacity, often to a breaking point, in orde ...
.
Types of monkey testing
Monkey testing can be categorized into smart monkey tests or dumb monkey tests.
Smart monkey tests
Smart monkeys are usually identified by the following characteristics:
* 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, which perform testing as per user's behavior and can estimate the probability of certain bugs.
Dumb monkey tests
Dumb monkeys, also known as "ignorant monkeys", are usually identified by the following characteristics:
* 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
Advantages
Monkey testing is an effective way to identify some out-of-the-box errors. Since the scenarios tested are usually
ad-hoc
''Ad hoc'' is a Latin phrase meaning literally for this. In English, it typically signifies a solution designed for a specific purpose, problem, or task rather than a generalized solution adaptable to collateral instances (compare with ''a pr ...
, 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
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.
Similar techniques and distinctions
While monkey testing is sometimes treated the same as
fuzz testing
In programming and software development, fuzzing or fuzz testing is an automated software testing technique that involves providing invalid, unexpected, or random data as inputs to a computer program. The program is then monitored for exceptio ...
and the two terms are usually used together, some believe they are different by arguing that monkey testing is more about random actions while fuzz testing is more about random data input.
[{{Cite web, url=https://stackoverflow.com/questions/10241957/difference-between-fuzz-testing-and-monkey-test, title=Difference between "fuzz testing" and "monkey test", website=stackoverflow.com, access-date=2016-04-22] 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
*
Random testing
Random testing is a black-box software testing technique where programs are tested by generating random, independent inputs. Results of the output are compared against software specifications to verify that the test output is pass or fail. In case ...
References
Software testing