What is Monkey Testing
By Neha Bharati, Community Contributor - June 10, 2022
In the software release cycle, testing plays a vital role in knowing software feasibility. There are many techniques used to test applications depending on the requirements. One such technique is monkey testing.
What is Monkey Testing?
Monkey testing is a type of software testing where an application is tested by giving random inputs usually based on the tester’s mood and analyzing its behavior or checking if it breaks the application.
It is best used when one wants to perform load testing on an application by providing many random inputs trying to break the application. Let’s dive into this in detail and look at more interesting facts about this technique.
Features of Monkey Testing
So what constitutes part of a monkey testing technique? There are certain unique features such as:
- There are no specifications as to what should be tested and how it should be tested
- It is mainly used to detect dependability and performance
- This technique is preferred when some bugs do not get detected in regular intervals
- It can be automated and integrated with popular testing tools like Selenium
- There are no defined test cases, and that is why it takes less effort than other types of testing
Monkey Testing Tools
There are some tools to automate tests for monkey testing applications efficiently. These tools generate random data to feed into the application, and then the output is reported, and bugs are discovered, if any. Some tools like MonkeyRunner and UI/Application Exerciser Monkey are used for android application monkey testing.
- MonkeyRunner for Android: It is used for monkey testing on Android applications. Using this tool, testers can execute android programs and record the output with screenshots through a Python program with MonkeyRunner. It can be used to run tests in unit testing. The function of the MonkeyRunner isn’t specific but it can test the application at a functional level.
- UI/Application Exerciser Monkey for Android: The MonkeyRunner tool tests the application form outside the Android code, but UI Exerciser Monkey runs in the ADB shell inside the emulator. It automatically generates tests like touches, gestures, or clicks. It is also automated and helps to run the application from the inside.
In case, one is looking to test mobile applications on real devices, BrowserStack has a robust testing infrastructure that includes products like App Live and App Automate, to perform manual and automated app testing respectively. Testing teams can access real-time devices, browsers, and operating systems to put their application through the paces. A couple of stand-out App Live features include:
- Instant access to Real Device Cloud (3000+ browsers and devices)
- Maximum device coverage (devices including iPhone, iPad, Samsung Galaxy, Nexus, Pixel, Motorola)
- Wide OS Range (OS versions spanning from Android 4.4 to 11 & iOS 8 to 15)
- Test Native Device Features (Natural Gestures, Geolocation testing, Network Throttling, In-App Purchases, etc)
Types of Monkey Testing
1. Dumb Monkey Testing
In this type of testing, the tester doesn’t know the application or workflow. The tester is directed to test it with random bugs, which can help in naively identifying significant bugs. The tester need not have any technical knowledge and test the application according to their understanding and enter invalid data.
2. Smart Monkey Testing
In smart testing, the tester knows the application and its workflow and tests the application with invalid inputs. The main objective is to surpass the application and report any bugs along the way. This method is in fact, useful for load/stress testing.
3. Brilliant Monkey Testing
This method is one step ahead of smart monkey testing. The tester has full knowledge of the application and is specifically deployed because they have domain knowledge about the application and can even identify some bugs that might be found in the future. Since the tester knows about the product, they can perform testing from a user’s viewpoint.
Also Read: Performance Testing: A Detailed Guide
Advantages of Monkey Testing
There are a few benefits of using Monkey Testing in SDLC:
- It doesn’t require extensive knowledge about the application
- It is cost-effective
- It is the best approach for reliability testing
- It can be used to identify bugs that cannot be discovered through traditional methods
- It is a good approach for load/stress testing
Disadvantages of Monkey Testing
There are certain limitations in using Monkey Testing:
- Since it uses random events and inputs it is challenging to discover bugs
- Since testers do not have defined test scenarios, it reduces the accuracy of the test cases
- The test coverage isn’t guaranteed since there are no pre-defined test cases
- It is difficult to regenerate the bugs if any are found, due to the random nature of the tests
Follow-Up Read: Fundamentals of Writing Good Test Cases
Monkey testing isn’t used in the industry as much due to its behavior and fundamental principle of random testing. It is usually preferred when all other methods have already been used. If done, it is advised to assign these to experienced testers to ensure maximum success. It is less preferred for projects that don’t have much time to test their applications.