Skip to content
Tutorials Center
My learning

Topics

Lesson 35 of 60 ยท Defects and Test Execution

Ad Hoc, Monkey and Gorilla Testing

Learn ad hoc, buddy, pair, monkey and gorilla testing: how they differ from exploratory testing, smart versus dumb monkeys, and a runnable random-input tester.

Most testing in this course is planned: techniques, cases, charters. But a lot of valuable testing is unplanned or deliberately random. A tester pokes around "just to see". A script hammers the screen with random clicks. Someone repeats a single module hundreds of times. These informal styles have names: ad hoc testing, monkey testing and gorilla testing. They are cheap, they find odd bugs, and they have clear limits, which this lesson explains.

Ad hoc testing

Ad hoc testing is informal testing with no test cases, no documentation and no fixed plan. The tester uses knowledge of the product and intuition to try things that seem likely to break. Results are recorded only if something fails.

It works best when:

  • the tester already knows the product well,
  • time is short and there is no scripted suite for the area,
  • scripted tests have all passed and you want one more look from a different angle.

Because nothing is written down, ad hoc testing is hard to repeat or measure. If it finds a bug, record the steps right away, or you will not be able to reproduce it later (see Bug Reports).

Buddy and pair testing

Two variations add a second person:

  • Buddy testing: a developer and a tester work together, usually early, on the same feature. The developer explains and fixes; the tester questions and tries odd inputs. Defects are found and often fixed in minutes.
  • Pair testing: two testers (or a tester and a business person) share one computer. One drives, one observes and thinks aloud, then they swap. Two heads notice more and the observer keeps the notes.

How it differs from exploratory testing

The two are often mistaken for each other. Exploratory testing is also unscripted, but it is disciplined: it has a charter (a mission), a time box, notes and a debrief, so it is traceable and can be managed. Ad hoc testing has none of that structure.

Ad hoc Exploratory
Plan None A charter and time box
Notes Only for bugs found Session notes, coverage and questions
Repeatable Barely Partly
Typical use Quick extra look Structured learning and test design in parallel

Monkey testing

Monkey testing feeds a program random input, as a monkey bashing a keyboard might, to see whether it crashes, hangs or corrupts data. The tester does not follow requirements and does not verify the output in detail; the only question is "does it survive?"

There are two main kinds:

  • Dumb monkey: generates completely random events, with no knowledge of the application. It may click the same dead area a thousand times. Simple to build, but shallow.
  • Smart monkey: knows something about the application: which screens exist, which inputs are valid, which events matter, so it creates more realistic random sequences and reaches deeper states. Smarter monkeys are harder to build, and find more.

A brilliant monkey is the nickname for a very smart one that also checks outputs and reports failures meaningfully.

Monkey testing is popular for mobile apps (Android's UI exerciser is called "monkey"), games and GUIs, where the number of possible event orders is huge. It is also close to fuzzing, which feeds malformed data to parsers and APIs to find crashes and security holes (see Security Testing Basics).

Limits: failures may be hard to reproduce unless the random seed is logged, and many "bugs" the monkey finds are unrealistic. Use a fixed seed and keep a log of the actions so that every crash can be replayed.

Gorilla testing

Gorilla testing hammers one module repeatedly and intensively, with many different valid and invalid inputs, until the team is confident that this piece is solid. Like a gorilla hitting the same spot, the focus is narrow and the pressure is high. It is usually run by a tester or a developer, often on a critical module such as login or payment, where a failure would be costly.

The idea is depth on one component rather than breadth across the product. It is not random in the same way as monkey testing: the person chooses inputs thoughtfully, but there are many of them.

Ad hoc Monkey Gorilla
Input Chosen by intuition Random Many chosen, valid and invalid
Scope Anywhere Whole app or screen One module, repeatedly
Knowledge needed Product knowledge None (dumb) or some (smart) Module knowledge
Main finding Odd defects Crashes, hangs Weak spots in one module

Try it: a dumb monkey versus a smart monkey

The function below is a tiny order form handler with a hidden bug: it crashes when quantity is zero and the coupon is FREE. We unleash two monkeys: one throws totally random values, the other knows the valid fields. Both use a seeded random generator so the run is repeatable.

JS Two monkeys attack a form handler

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The dumb monkey never builds the exact combination qty = 0 with coupon = "FREE" (it finds nothing in this run), because most of its input is rejected at the first check. The smart monkey reaches the interesting code quickly. The fixed seed (7) means anyone can replay the same run.

Try it: gorilla testing one module

Now the gorilla: one function (a password-strength checker), hit with a large batch of chosen inputs, both valid and invalid, and a check that its answer is always one of the three allowed labels.

JS A gorilla batch against one module

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Gorilla runs like this are often turned into permanent automated tests once they pay off.

When to use these techniques

  • Use ad hoc and pair testing as a quick supplement, never as the only testing.
  • Use monkey testing for stability on UIs and apps with huge event spaces, always with a seed and a log.
  • Use gorilla testing on the few modules where failure is most costly.
  • Prefer exploratory testing when you need informal testing that is still reportable.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the biggest difference between ad hoc and exploratory testing?

    Both are unscripted, but exploratory testing is managed through charters, session notes and debriefs.
  2. 2. Which tool is a smart monkey?

    A smart monkey has some knowledge of the application's structure, so its random input reaches deeper states than a dumb one's.
  3. 3. Why should monkey tests log the random seed?

    A random failure that cannot be reproduced is hard to fix. The seed lets you regenerate the same sequence.
  4. 4. Gorilla testing is best described as:

    Gorilla testing focuses heavily on a single, usually critical, component.

Summary

  • Ad hoc testing is informal and unplanned; buddy and pair testing add a second person.
  • Exploratory testing adds charters and notes to unscripted testing; ad hoc has none.
  • Monkey testing uses random input to check stability; smart monkeys know the application, dumb ones do not.
  • Gorilla testing batters a single module with many inputs.
  • Log seeds and actions, and record steps for any bug you find.

Next up: Test Management Tools.