A quick way to use the Monkey testing tool

Clear: Monkey is a command that runs directly in the adb shell

1. First copy the Android-sdk to a path of the computer (the SDK is relatively large, 10.3G, you can use the mobile hard disk to copy it here)

2. Then configure the adb environment variable of android, the method is as follows (the configuration method I searched on the Internet has been refined, it is relatively simple, just follow the operation):

The first step is to open the environment variable configuration window. Right-click on the computer, properties-advanced system settings-environment variables.

The second step is to add the android system environment variables. Click the New button under System Variables, enter the environment variable name android (your own customary naming), and import the path of the android development tool

Open Android-sdk->platform-tools, copy this path, and then paste it into the variable value, then open tools, copy the path, and paste it into the variable value, note that the two paths are separated by English separators

The third step is to select Path in the system variable, click the edit button, copy and paste the variable value just added to the back of path, and separate it from the previous content with an English separator, then enter the English separator, and then add the variable name to the back, pay attention to adding % before and after, and an English semicolon after

The fourth step is to test the environment variables.

First open the run command, run in the start menu

1. In the last step, enter cmd in Run to call the command operation window. After entering, enter adb to view the running results.

After completing the configuration, we can use it directly, and then execute the test, as follows:

Connect the mobile phone to the computer, and execute adb shell under cmd, so that the mobile phone can be accessed. If the mobile phone is not recognized, it is because there is no driver, and the driver needs to be installed.

How to install the driver?

Download the computer version of 91 Assistant on the Internet, connect the mobile phone after installation, you need to turn on USB debugging in Settings -> Developer Options.OK

2. Re-execute the adb shell under cmd, and the phone will be recognized at this time

3. Then enter the following command: Execute the command: monkey -p com.baidu.BaiduMap --throttle 500 -v -v -v 1000000 >/sdcard/monkey.log &logcat -v time >/sdcard/logcat.log & (see the introduction of Monkey for detailed command parameters) This command is a common command for testing. If you need to set other parameters, you can learn according to the detailed introduction of the Monley test introduction

4. At the same time, you can execute adb logcat -v time >>file in another cmd window (this will print the execution log to the specified file). If you don’t want to store it in the C drive, you can store it in other paths: for example, adb logcat -v time >>d:\file

5. After the test is completed, enter the mobile phone/sdcard/monkey.log, and export the log. If you open the log directly, you can view the log directly, download an EditPlus from the Internet, and use this tool to open the log file. It is clear and easy to find crashes and ANRs. Use Ctrl+F to quickly locate them

(Search the event number of the prompted crash in monkey, and search for crash, anr, exception in fie)

Here are two of the more common questions:

1. How to end the test if the test is not completed?

There are two methods:

(1) Unplug the data cable directly, then restart the phone

(2) Type the command in cmd:

ps (ps refers to all processes) and then find the process number corresponding to Monkey, which is generally easier to find, then kill this process, enter the kill+process number command, so that the test can be terminated

2. During the execution of Monkey Test, the test will generally stop in the following two situations:

(1) If the application crashes or receives any runaway exception, Monkey will stop and report an error.

(2) If the application generates an application not responding (application not responding) error, Monkey will stop and report an error.

The solution to avoid this phenomenon: --ignore-timeouts Monkey will stop running when any timeout error occurs in the application (such as "Application Not Responding" dialog box). If this option is set, Monkey will continue sending events to the system until the count is complete

--ignore-crashes

Used to specify whether Monkey stops running when the application crashes (Force & Close error). If this parameter is used, even if the application crashes, Monkey will still send events until the event count is complete.

How to get the package name:

adb shell

pm list packages

If my blog is helpful to you, if you like my blog content, please "Like", "Comment", "Favorite" with one click!

The following is the supporting information. For friends who do [software testing], it should be the most comprehensive and complete preparation warehouse. This warehouse also accompanied me through the most difficult journey. I hope it can help you too!

Software testing interview applet

The software test question bank maxed out by millions of people! ! ! Who is who knows! ! ! The most comprehensive quiz mini program on the whole network, you can use your mobile phone to do the quizzes, on the subway or on the bus, roll it up!

The following interview question sections are covered:

1. Basic theory of software testing, 2. web, app, interface function testing, 3. network, 4. database, 5. linux

6. web, app, interface automation, 7. performance testing, 8. programming basics, 9. hr interview questions, 10. open test questions, 11. security testing, 12. computer basics

Information acquisition method:

Guess you like

Origin blog.csdn.net/myh919/article/details/131768340