Monkey Tests

Monkey testing should be a part of every significant software testing effort. Monkey testing is the process of feeding random input to your system under test. For example, if you were applying monkey testing to a simple calculator program, you would randomly hit a random number of various input keys.  The origin of the term monkey testing derives from the Infinite Monkey Theorem which states that a monkey hitting typewriter keys at random will almost surely eventually produce every book in the French national library. The theorem is derived from a similar statement in a 1913 book by French author Emil Borel. The phrase was Anglicized in the 1970s to variations like, "an infinite number of monkeys typing for an infinite amount of time will eventually produce all the works of William Shakespeare."


Although manual monkey testing is possible, monkey testing is almost always performed using automation. It turns out that it quite useful to classify monkey testing into either two or three categories based on how intelligent the virtual monkey is. The simplest type of monkey testing is "dumb monkey" testing. In dumb monkey testing, the virtual monkey test automation knows almost nothing about the system under test (SUT). The monkey test program simply feeds random input to the system under test. For example, suppose the SUT has a text box which is designed to accept a user-supplied URL as input, like "". A dumb monkey test program supplies random characters to the text box, not even attempting to make a valid URL, and then submits the characters. Dumb monkey testing has the advantage that it is relatively cheap to implement. However, dumb monkey testing does not have the ability to compare an expected result with an actual result, so dumb monkey testing will only uncover bugs which produce a crash or hang in the SUT.


In "smart monkey" testing, the test automation has some knowledge of the SUT inputs, states, and expected results. For instance, in the previous URL-input example, a smart monkey test may know the structure of a valid URL and expect different kinds of results for valid and invalid inputs. Smart monkey systems are much more difficult to create but can uncover bugs other than hanging and crashing bugs.


Of course, the labels "smart" and "dumb" monkey tests are arbitrary. Monkey tests can take on a continuum of sophistication. A "brilliant monkey" test system might use some rudimentary artificial intelligence to more closely mimic realistic user input. For instance, you could write a monkey system which knows that certain letters on a keyboard which are physically close together are often accidentally switched by human users.


Based on my experience, I’ve found that relatively dumb monkeys give you the best test-bang for the test-buck. In a tight development cycle, the time cost of developing a smart monkey is usually too high for the quality improvement payoff.


If you enjoyed reading this blog entry, you might enjoy working at Microsoft. My parent company, Volt Information Sciences, is always looking for software engineers. Check out the job listings at



This entry was posted in Software Test Automation. Bookmark the permalink.