In this article in Software Testing Tutorial, we will learn What is Monkey Testing, Uses and Types of Monkey Testing and the following.
What is Monkey Testing
Monkey Testing is a black box testing technique in which the tester provides random inputs and applies actions in the software application to verify the behavior of the system. This helps us to evaluate whether the system crashes when given such unexpected inputs. Here inputs can be data that is entered into the application or clicking a button for the next action or clicking on a link to navigate to another page.
- Monkey testing is executed by entering random inputs or unexpected actions into the software to verify its behavior and find out if it gives any error.
- Monkey testing is executed by testers or developers or any stakeholders, who may or may not have the knowledge and understanding about the domain and the logic of the application.
- In Monkey testing, the tests are executed randomly, both valid and invalid scenarios are verified here.
- In Monkey testing, we do not follow any test case, there are no predefined conditions to follow in this technique.
- As monkey testing follows such a random technique, the tester might find it hard to reproduce the bug found during testing.
- Monkey testing is similar to fuzz testing but the major difference here would be the repetitive random action, clicks, and unexpected navigation flows.
- In Monkey testing, there is no predefined strategy or test cases, so it is based on the tester’s gut and intuition.
- Monkey testing is more efficient while doing stress testing.
What is Gorilla Testing
Gorilla testing comes under a manual testing technique in which a tester would test a module repeatedly to test the robustness of the module. Here the developer and tester join hand in hand to test a particular module in all aspects.
In Gorilla testing, each module of the application is taken one at a time and a range of valid and invalid inputs are entered to verify those modules. These input values are taken randomly.
Gorilla testing aims to examine the capacity of single module functionality. In Gorilla testing, every minor code of the application is tested until it starts to fall apart or fails to give the expected results.
- As Gorilla testing focuses on testing the individual modules, it can capture bugs in the early stage, thus reducing cost with high coverage.
- Gorilla testing ensures even an errant user won’t get into any failures.
- Gorilla testing helps the team to understand the tolerance level of the system.
- Usually, testers and developers collaborate to perform Gorilla testing
Monkey Testing vs Gorilla Testing
Both Monkey testing and Gorilla testing have the common strategy of applying random inputs to the application but they are major differences in the way it verifies the application.
|Monkey Testing||Gorilla Testing|
|Monkey testing does not use any test cases to test an application, it just random inputs to tests the application||Gorilla testing ensures that a module doesn’t have any issues by performing repetitive tasks of inserting random inputs to a module|
|Monkey testing is also called random testing as it uses random input values||Gorilla testing is a type of manual testing, it is also known as repetitive testing or Torture Testing or Fault Tolerance Testing|
|Monkey testing checks the performance of the entire application using these random inputs to ensure that the system does not crash due to unexpected values||Gorilla testing aims to test a single module thoroughly|
|Monkey testing can be executed by any stakeholder in the project||A developer or a tester with a good knowledge of the application is required to perform gorilla testing|
|Monkey testing focuses on crashing the entire system with random inputs||Gorilla testing focuses on testing the functionality of a specific module at a time|
Monkey Testing vs Ad-hoc Testing
Both Adhoc testing and Monkey testing are similar in the way of not following any test cases, let’s look at how they differ from each other.
|Monkey Testing||Ad-hoc Testing|
|Monkey testing focuses on breaking the application with random inputs||Ad hoc testing focuses on finding bugs that are not covered in test plan/ test cases|
|In monkey testing, the bugs are found based on the random input values.||In ad hoc testing, the bugs are found based on the unexplored areas of the application.|
|In Monkey testing, the testers will not know the application, they test the application by randomly clicking or entering data to check if it leads to an error.||In Ad hoc testing the tester will have good knowledge about the application and proper understanding about the functionalities.|
|In Monkey testing, the tester need not be an expert in the domain or have any in-depth knowledge about the application.||In Ad hoc testing, the tester will know the exact workflow of the application along with the domain knowledge.|
|Monkey testing can be executed by any stakeholder.||Ad hoc testing is usually done by a tester who knows in and around the application|
Uses Of Monkey Testing
- Monkey testing does not require many specifications while performing this test.
- Monkey testing completely focuses on crashing the system by hitting random inputs, so the testing team can guarantee the robustness of the product.
- Monkey testing is executed in certain areas of the software where the errors are not identified at regular intervals.
- Monkey testing requires lesser time and effort when compared with other kinds of testing. Monkey testing ensures that the software application is reliable and efficient.
- Monkey testing helps us understand how the application’s behavior when given to a user with no idea how to use it.
- Monkey testing can also be used to perform database testing. It can be done by initiating a transaction and entering random data or performing random actions and then rolling back to see if it crashed or if any corruption of the database occurs.
Types of Monkey Testing
Monkey testing can be categorized into three types based on how it’s implemented.
Dumb Monkey Testing
In monkey testing, when the tester has no knowledge about the software or features, functionalities, behavior and starts testing the application randomly, it’s called the Dumb monkey testing technique. It’s also known as ignorant monkeys.
The tester usually has no idea whether given inputs are valid or invalid.
Dumb testing is pretty simple as it doesn’t require the tester to know about the behavior of the application.
The tester also known as the dumb monkey in this testing has no idea about the flow of work or the required data that needs to be fed to the application in an ideal environment.
But this can lead to hard to reproduce bugs as the tester does not know the application and the bugs that are found can be less critical or irrelevant.
Smart Monkey Testing
In monkey testing, when the tester has a deep understanding of the workflow of the software, it is known as smart monkey testing.
Here the testers know what they are testing, where they are testing and where will this lead to. This will be very helpful in reproducing the bug.
In this type of monkey testing, the testers focus more on breaking the application rather than finding bugs, as they are aware enough to report those bugs.
Comparatively, smart monkey testing provides better results in less time.
Brilliant Monkey Testing
In monkey testing, when the tester has advanced knowledge about both the application’s functionalities and the domain expertise, it is called Brilliant monkey testing.
Let’s say we are testing a train ticket booking application, the tester will know how the application works and will have a clear picture of how it should and shouldn’t work under random inputs.
The chances of finding irrelevant and not reproducible bugs are very less in this testing.
Here the tester performs the test from a user’s perspective, as they know the usage of the application.
Brilliant monkey testing technique an extension of the smart monkey testing.
This technique can help us find bugs that might occur in the future span of its functioning.
Advantages of Monkey Testing
- It is easy to execute as it does not follow any specific predefined cases, the tester has to give random inputs to the application.
- It is an effective way to find some out-of-the-box errors
- It is a great way to find major bugs that might break the system due to random inputs.
- New bugs can be discovered through monkey tests which would have not been found during traditional testing.
- The scenarios covered under monkey testing are ad hoc, the testers can test the server response time along with it.
- Monkey testing can be executed in a desktop application, web application, and mobile applications well.
- Monkey testing needs less time and effort to set up the environment.
- Monkey testing is the best approach to perform stress testing and load testing in an ad hoc manner.
- Monkey testing can be executed using automated tools too.
Disadvantages of Monkey Testing
- The tester may not be able to reproduce the bug as this is done so randomly.
- The bugs found in monkey testing can be out of scope or out of business requirements.
- Only testers with good domain and technical expertise can perform monkey Testing accurately.
- It can be time-consuming to get those random inputs, execute cases for a small set of bugs that might not be even relevant.
- Test case coverage can’t be guaranteed as it is done so randomly.
- Only smart monkey testing and brilliant monkey testing can bring out relevant and reproducible bugs, but the cost is higher as it requires expert resources.
- It can be challenging and time-consuming to analyze bugs found during monkey testing.
- Smart monkey testing depends on a good state model but developing such models can be pretty expensive.
What are the tools used for monkey testing?
We can automate monkey testing, several software tools mimic a monkey entering random data. These data values are random and pre-compiled which can be used to test the application for OWASP issues.
Monkey testing can be executed efficiently by automating the process. These tools are developed to generate random data and execute them to the application. Even random actions and clicks are programmed in these tools.
Once the tool is executed, it observes the behavior of the application and reports the output.
The initial cost of such tools might be high but once it is set up, monkey testing can be made much more efficient.
MonkeyRunner tool is used for performing monkey testing on an Android application.
This tool provides an API for writing the code that can control an Android device or emulator from outside of Android code.
You can run programs to send keystrokes, take a screenshot of the user interface, and store screenshots by writing code in Python
UI/Application Exerciser Monkey on Android
This tool generates pseudo-random streams of user events such as clicks, touches, or gestures for an emulator or android device. Here we can use this tool to execute monkey testing in a random yet repeatable manner.
We can use monkey testing to analyze the scenarios in which the customer might use the application. Not every user uses the application in the way it’s intended, they might bombard the system with inputs when they don’t get the expected results. Thus the tester has to verify the application from a user’s perspective. Monkey testing helps us prevent such scenarios where the system might break due to unexpected inputs.
Unlike other testing techniques, monkey testing does not follow any particular pattern or test cases. Thus it is very less time-consuming and we can find critical bugs without following a predefined set of scenarios. A huge drawback here is that it doesn’t guarantee that this technique can identify all the bugs but it aims to test the application using all possible inputs.
Due to a lack of resources, time, and higher priority projects monkey testing is not widely used across the industry. They invest in other forms of testing which give better results and return on investment.