What is Monkey Testing | Trivia, Types, Tools & Benefits

I first heard the term ‘Monkey Testing’ from a developer when I was 1 year old in IT industry. The developer was quite friendly & wasn’t confident enough about his code – “Hey, let’s do some Monkey Testing” he said. He sat with me and that was my first experience with practical Monkey Testing. Yeah! The name sounds funny, but this technique surely works (if you know the impacted areas). In this article let’s explore ‘Monkey Testing’ in detail.

“You never can predict how the user will use your product once they get it in their hands.”

What comes to your mind when you hear ‘Monkey’? Yeah! Mischief-maker. And why? Because his/her actions are ‘Random’. You cannot predict a monkey’s actions. Taking a cue from here, Monkey Testing is nothing but a technique where the user tests the application or system by providing random inputs and checking the behavior, or observe whether the application or system will crash. Randomness makes the monkey happy 🙂 Technically known as “Stochastic testing”, Monkey testing can be performed for desktop, web as well as mobile applications.

Note: Testers are NOT Monkeys 🙂 It’s just an effective Testing technique. There are no rules; this technique does not follows any predefined test cases or strategy and thus works on Tester’s gut feeling.

Types of Monkey testing

Just like humans, Monkeys too can be either smart or dumb. And both techniques are useful in Software Testing.

Smart Monkey tests

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 find

Dumb Monkey tests

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 unknowingly find important bugs that are hard to catch

Advantages of Monkey Testing

As you might have guessed,

Monkey testing can help to identify some out-of-the-box errors which your scripted or automated tests can’t. The intrinsic randomness of monkey testing also makes it a good way to find major bugs that can break the entire system.

Additionally the setup of monkey testingis easy, i.e. you can even start testing right-away without much preparation. Arranging random tests against random data is easy way to test the system.

It can discover some really good bugs like memory leaks or hardware crashing.

During regular testing we normally ignore many cases thinking that “this scenario” will never happen. Doing monkey testing can actually dig out these scenarios.

This technique works very well when doing load / stress testing when you try to break the application by proving non-stop random inputs. A good technique to test the reliability of the system.

Smart monkeys, if properly set up with an accurate state model, can be really good at finding various kinds of bugs.

But there are some drawbacks too,

The scenario may not be definable and may NOT be the correct business case.

The randomness of monkey testing often makes the bugs found difficult or impossible to reproduce.

Unexpected bugs found by monkey testing can be challenging and time consuming to analyze.

Additionally, it might happen that NO bugs are found during Monkey testing, then? Yeah! Though defects are not identified but still it will build some confidence in the system!

Don’t worry, we have Monkey tools

Tools can be used to make Monkey Testing automated, effective and efficient. How? Simple! Monkey tool will randomly perform actions in the application OR enter random inputs to the system and then capture the results. Programs / scripts that can generate random inputs and feed into the application under test and analyze the behavior. Though it will require some setup to be done, an automated monkey testing tool can be a means of efficiency if used properly. Since Monkey Testing is not yet established (or accepted) industry-wide, these tools have less identity unlike other automation tools.

Monkey Testing is also included in Android Studio as part of the standard testing tools for stress testing. The MonkeyRunner tool provides an API for writing programs that control an Android device or emulator from outside of Android code. With MonkeyRunner, you can write a Python program that installs an Android application or test package, runs it, sends keystrokes to it, takes screenshots of its user interface, and stores screenshots on the workstation.

The Android SDK also has a UI Exerciser Monkey that handles most interface-level and system-level events. The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner.

Pro Tip: It’s advisable to follow this technique (if at all) at the later phase of testing when all the functionalities are tested and there is some level of confidence on the effectiveness of the application. Additionally if we are using a program or script that generates valid and invalid random inputs, the analysis becomes a bit easier.

Trivia

“A thousand monkeys at a thousand typewriters will eventually type out the entire works of Shakespeare”

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 (stated above). 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.

The effectiveness of monkey testing is heavily dependent on the kind of instructions the testers have provided. It’s an established fact that a single testing tool or method cannot free a software of bugs and errors. The right combination of test methods and tools, based on error detection efficiency, cost and testing speed is the best guarantee that a product at its optimum condition is delivered to the end user.

Next time don’t just be a horse with a bridle around you – driven by the test cases, plans & strategies and controlled by the quality metrics. Try Monkey testing!

The Software testing community experienced an exciting year of 2017 with many trends taking shape. Applications of artificial intelligence (AI) and automation, continuing trend in adoption of DevOps, increasing test automation, shortening release schedules, and the lack of time for testing. The prevailing state of software testing is getting more challenging with every day passing. With the huge demand for high-quality products within a short time span, the role of testing has grown beyond just another process. Not a single software product could be released without its quality testing and bug fixing. The Software testing industry is always evolving and transforming to new horizons that’s why it’s better to forecast and predict such trends ahead of everyone. This article makes bold predictions for Software Testing trends of 2018.

Continuing on our previous article – Comprehensive list of Software Testing Types | Agile, Acceptance, Beta & Ad-hoc are NOT the ‘Testing Types’, let’s deep dive into the world of different Testing Types. (Hope you have gone through the basics “Attention! Get your facts clear before facing an interview!” to clarify most of the doubts about different Test terminologies.

The complexity of Software systems and the demand of customers and users are increasing every day. It has become evident that testing must be treated as a disciplined and controlled process. Test professionals must learn precise techniques and methods by which they can deliver software with a much higher degree of confidence. Individuals who are charged with the responsibility of testing computer systems must receive formal education, i.e. Testing Certifications. Testing certifications are in great demand! It is assumed that you already have one of them or at least you are planning/preparing to have one of them soon. Being a Software Tester, is it mandatory to have an ISTQB Certification?

Are you a Manual Tester? A Test Lead? Good in people’s management? Or Planning? Whatever! You still need to know the basics of programming and automation tool. You need not be a framework-developer, but every organization now wants a Software Tester who knows both functional test + automation scripting!

The Defect Severity (Technical) - In simple words, how severe is the defect for the application’s quality? Say you click on the ‘Help’ link and the application crashes. Whoaa! Bing-Bang Craaaashh..! Quite a severe defect, right?

The Defect Priority (Business) - In simple words, what is the precedence, importance or urgency to fix a defect? Say you click on the ‘Help’ link and the application crashes. Whoaa! Bing-Bang Craaaashh..! Quite a severe defect, right? But how many of us really click the ‘Help’ link? Business usage statistics show less than 2%. Now what do you think should be the urgency to fix a defect that impacts just the 2% of the end-users? Yeah! Not ‘High’ obviously. There would be other urgent defects to fix prior to this. Defect Priority defines the order in which defects should be fixed, i.e. its impact to the end-users, the business perspective.

About STS

Software Testing Studio is an attempt to share some incredible knowledge from industry leaders & experts, which should be helpful for anybody to start his/her career in ‘Software Testing’ or to progress it further. Apart from the technical nitty-gritties, one can also find some intellectual posts by industry experts sharing their Wisdom.