DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Implementing SOLID Principles in Android Development
  • How Does WebView Actually Work on Android?
  • How To Integrate Chatbot With an Android App
  • Guide for Voice Search Integration to Your Flutter Streaming App

Trending

  • Automating Data Pipelines: Generating PySpark and SQL Jobs With LLMs in Cloudera
  • The Role of Functional Programming in Modern Software Development
  • AI-Based Threat Detection in Cloud Security
  • Teradata Performance and Skew Prevention Tips
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. How Can Perform Monkey Testing in Android App?

How Can Perform Monkey Testing in Android App?

Learn what Monkey Testing is, and the ways to implement it through either Command-line testing and Android studio.

By 
Rahul Panchal user avatar
Rahul Panchal
·
Nov. 26, 19 · Tutorial
Likes (5)
Comment
Save
Tweet
Share
31.9K Views

Join the DZone community and get the full member experience.

Join For Free

Surprised monkey

Wait...what is Monkey Testing? 

What Is Monkey Testing?

Android Monkey is the python-based testing script process that can be run by writing any specific python script or we can directly apply a test for the installed application using the command line.

Once the test process will be done then it will generate a log file of the events and crash if any. Generally, these testing tools are for the application developers while development in progress. Android SDK should be available in the system.

This will randomly check for user events such as clicks, touches, or gestures, as well as several system-level events.

Also, if we try Monkey testing Using the Command line and Using Android Studio, then both will generate the same logfiles with a different extension.

There Are Two Processes to Go Through This Testing Process

  1. Using Command-Line.
  2. Using the Android Studio.

Using Command Line

For this process, the app should be installed on the device. Install the app first and then execute the below command in the command line.

  1. Install APK and Run the application in the device.
  2. Go to ../Android_Sdk/Platform-Tools directory.
  3. Execute command ‘adb shell monkey -p yourpackageneme -v 1000 > app_log.txt’.

Output

Also, I have added one video tutorial link below (#4). If you will go through the video, then there is one ADB command with the output file name.

To check the exported log, Go to /Android_Sdk/Platform-Tools directory. You will find the app_logs.txt file there.

 Using Android Studio

You can also execute this test from the Android studio by adding some required plugins.

  1. Import Project into Android Studio.
    1. File – New – Import Project – Choose Your Project Directory and Click Ok.
    2. Wait until all process is done.
  2. Install Monkey Plugin

File – Settings – Plugins

a. Click on Marketplace and Search for “MonkeyMaster” and click “Install”

MonkeyMaster screenshot

b. Once Install Done, the button will change with “Restart IDE”. Click to Restart Android Studio.

c. Once Restart, you can see Monkey Plugin installed in the Android Studio.

3. Run the Application in Device.

4. Click on Monkey at the bottom bar.

     a. Click on [+] Button.

expanded view screenshot

b. Click Refresh, if you cannot see your attached device.

c. Once Refresh, you will see Device ID inbox.

Device ID screenshot

d. Choose it and click OK.

e. Click on Play Button and One popup will open to set Monkey Configuration.

Monkey configuration screenshot

f. Add provided Your app package name in the “Allowed Packages” box and press Run.

Config Monkey Runner screenshot

5. Money Testing will start and you can see Process and Log data at the bottom.

Output

If you will execute monkey testing from the android studio, then you can see the testing log output at the bottom under the "monkey" tab.

code block monkey testing screenshot

If you will execute Monkey Testing using Android Studio then IDE will generate a file with the ".monkey" extension inside the project itself. Once the testing process will be done by IDE then your code will have one new “Monkey” directory.

IDE file screenshot

Monkey folder screenshot

Some Ref Links:

#1: https://developer.android.com/studio/test/monkey

#2: https://medium.com/@soonsantos/guide-to-run-monkeyrunner-e9363f36bca4

 Some Video Tutorials:

#3: https://www.youtube.com/watch?

#4: https://www.youtube.com/watch?-6RXVc

#5: https://www.youtube.com/watch?-Ktvk4

Conclusion

This post will give you a basic idea and information about how we can perform monkey testing in Android App.


Further Reading

Chaos Monkey for Spring Boot Microservices

Android (robot) mobile app

Opinions expressed by DZone contributors are their own.

Related

  • Implementing SOLID Principles in Android Development
  • How Does WebView Actually Work on Android?
  • How To Integrate Chatbot With an Android App
  • Guide for Voice Search Integration to Your Flutter Streaming App

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!