Monkey test mobile phone bug reproduction and resolution method

Source: Internet
Author: User
Tags email account

1.1 Monkey Test Introduction

Monkey testing is a means of automated testing of the Android platform, through the monkey program to simulate the user touch screen, sliding trackball, keystrokes and other operations to stress the program on the device, the detection of how long the program will be abnormal.

1.2 Monkey Program Introduction
1) Monkey program is brought by Android system, written in the Java language, the storage path in the Android file system is:/system/framework/monkey.jar;

2) The Monkey.jar program is initiated by a shell script called "Monkey", where the shell script is stored in the Android file system:/system/bin/monkey, so that it can be executed in the cmd window: adb Shell Monkey {+ command parameter} for monkey test.

1.3 Simple Help for Monkey commands
To get the simple help that comes with the Monkey command, execute the command in CMD:
ADB Shell Monkey–help

1.4 Monkey Command Parameter introduction
Refer to MTK related documentation.

Android_monkey_test_sop.pdf

monkey_test_sop_customer_mt6572_4.x. pdf

1.5 Monkey Test steps
Step 1: Manually import the APR tool after downloading the user version.

Step 2: Restart your phone after importing, connect the USB cable, run Logserverinstall.bat.

Step 3: After running the phone will automatically restart, restart after the end of the phone type *#* #2012 #*#*, to enter the corresponding interface is the APR installation success.

Step 4: Connect your phone to your computer, open adb: type adb shell PS logserver, query the PID value of Logserver, and then type adb shell kill pid (Logserver pid).

Step 5: Type adb shell PS logserver again to view Logserser has been killed.

Step 6: The phone connected to the computer, open the USB storage, in the phone memory (or SD card), create a new TXT file named Whitelist, the file to enter the name of the module you want to run, each module input after enter the next, if you are unfamiliar with the module name can refer to the Monkey test report, There is a module rehearsal information inside.

Example: Com.chinamobile.cmccwifi

Com.cmcc.mobilevideo

Com.hisunflytone.android

Step 7: After the completion of the previous step, the mobile phone into the corresponding APK module, such as: Whitelist want to run Sina Meager, UC browser, mobile phone side into these applications, the first use of the cue box off, remember to check the option of never prompt to avoid running monkey can not be normal test.

Step 8: Connect your phone to your computer and open adb.

Step 9: Type adb shell, enter after entering

Monkey--pkg-whitelist-file/mnt/sdcard/whitelist.txt--throttle--ignore-crashes--ignore-timeouts-- Ignore-security-exceptions--ignore-native-crashes--monitor-native-crashes-v-v-v 200000 >/mnt/sdcard/Stability _base.txt

Step 10: At this point, you can start the monkey normally and record the start time.

Step 11:monkey after the phone connected to the computer, run Getdatalog.bat, generate Datalog. Connect the USB storage, locate the Stability_base.txt file on your phone, and view the last modified time, which is the last time the monkey runs.

Analysis and processing skill of 1.6 monkey test problem
Monkey test is mainly responsible for testing, research and development side of the test to reproduce the problem and give the test recommendations, key work or monkey problem analysis, including freeze screen, the crash restart, crash and so on. Because this kind of problem analysis is more troublesome, so generally if there is no correlation analysis experience can first locate the problem, prepare the relevant log with MTK analysis or find the department has relevant experience in the research and development personnel to cooperate with the analysis.

1.7 Monkey Test Considerations
Precautions:

1. Test off all network switches (WiFi and data connection)

2. Turn on unknown sources under security settings

3. Phone Connection Power charge

4. If there is a module about audio, please insert the headset to avoid affecting other colleagues

5. If the test information module needs to install the test tool testwizard.apk, automatically generate call logs, SMS (Number 10)

6. If the test file manager needs to store a picture/music/apk/video/txt Such files in the T card

7. The test library is required to store 100 pictures and videos in the T card, the same music and video player also need to store not less than 50 chip source

8. Test email needs to create more than two accounts

9. Before the test run over the phone with the first hint of instructions, such as Input Method, folder window, apk prompt, etc.

10. If you are having trouble testing and want to start the test again, you must re-type the ADB command after unplugging the board to restart.

1.8 Monkey Test Command
1. Run All APK command

Monkey--throttle--ignore-crashes--ignore-timeouts--ignore-security-exceptions--ignore-native-crashes-- Monitor-native-crashes-s 800-v-v-v 200000>/mnt/sdcard/stability_all.txt

2. Run White list order

Monkey--pkg-whitelist-file/mnt/sdcard/whitelist.txt--throttle--ignore-crashes--ignore-timeouts-- Ignore-security-exceptions--ignore-native-crashes--monitor-native-crashes-v-v-v 200000 >/mnt/sdcard/Stability _base.txt

3. Run the Blacklist command

Monkey--pkg-blacklist-file/mnt/sdcard/blacklist.txt--throttle--ignore-crashes--ignore-timeouts-- Ignore-security-exceptions--ignore-native-crashes--monitor-native-crashes-v-v-v 200000 >/mnt/sdcard/Stability _base.txt

Analysis of 1.9 Monkey test problem
Monkey test log for the standard MTK log, the common problems are the following: Crash, NE, KE, ANR and so on.

Test first off the MTK log, the SDcard card and phone memory of the old log cleanup hurriedly, the most relevant interference files clean up, or later remove log is easy to cause trouble.


Precautions:
1) Each module using 3 Mobile phone test, after the test is completed to restore the factory settings in testing other modules, to avoid residual files affecting other modules test results.

2) test the modules that require resources before testing.
Info: Import 500 SMS
Contact Person: Import 500 contacts
Music: Importing 100 songs
Video: Import 20 videos
Browser: Insert a rich SIM card, turn on data connection, connect WiFi
FM radio: inserting headphones
Email: Login Email Account

3) Some modules are first entered with instructions for use or protocol instructions, and need to be manually clicked upon to complete the test.
Application market: Tick no more reminders, complete all prompt confirmation
Subject: Tick no reminders, complete all prompt confirmation
Camera: Tick No more reminders, complete all prompt confirmation
GALLERY: Tick No more reminders, complete all prompt confirmation
......
Because too many applications are not listed, each module before testing manually into the view, complete all the navigation in the test.


Monkey Test Commands

1.
Run All APK command: (>2 hours)
Monkey--throttle--ignore-crashes--ignore-timeouts--ignore-security-exceptions--ignore-native-crashes-- Monitor-native-crashes-s 1000-v-v-v 30000 1 >>/mnt/sdcard/stability_base.txt 2>>/mnt/sdcard/Stability_b Ase_err.txt

Run the Single apk command (>6 hours):
Monkey--pkg-whitelist-file/mnt/sdcard/whitelist.txt--throttle--ignore-crashes--ignore-timeouts-- Ignore-security-exceptions--ignore-native-crashes--monitor-native-crashes-s 1000-v-v-v 90000 1 >>/mnt/sdcard /stability_base.txt 2>>/mnt/sdcard/stability_base_err.txt

Run the Single apk command (>2 hours):
Monkey--pkg-whitelist-file/mnt/sdcard/whitelist.txt--throttle--ignore-crashes--ignore-timeouts-- Ignore-security-exceptions--ignore-native-crashes--monitor-native-crashes-s 1000-v-v-v 30000 1 >>/mnt/sdcard /stability_base.txt 2>>/mnt/sdcard/stability_base_err.txt

2.
Run All apk command (>12 hours):
Monkey--throttle--ignore-crashes--ignore-timeouts--ignore-security-exceptions--ignore-native-crashes-- Monitor-native-crashes-s 1000-v-v-v 180000 1 >>/mnt/sdcard/stability_base.txt 2>>/mnt/sdcard/Stability_ Base_err.txt

Run All apk command (>12 hours) to add a blacklist:
Monkey--pkg-blacklist-file/mnt/sdcard/blacklist.txt--throttle--ignore-crashes--ignore-timeouts-- Ignore-security-exceptions--ignore-native-crashes--monitor-native-crashes-s 1000-v-v-v 180000 1 >>/mnt/sdcar D/stability_base.txt 2>>/mnt/sdcard/stability_base_err.txt

Run the Single apk command (>12 hours):
Monkey--pkg-whitelist-file/mnt/sdcard/whitelist.txt--throttle--ignore-crashes--ignore-timeouts-- Ignore-security-exceptions--ignore-native-crashes--monitor-native-crashes-s 1000-v-v-v 180000 1 >>/mnt/sdcar D/stability_base.txt 2>>/mnt/sdcard/stability_base_err.txt
3.
Run All apk command (>24 hours):
Monkey--throttle--ignore-crashes--ignore-timeouts--ignore-security-exceptions--ignore-native-crashes-- Monitor-native-crashes-s 1000-v-v-v 360000 1 >>/mnt/sdcard/stability_base.txt 2>>/mnt/sdcard/Stability_ Base_err.txt

Run All apk command (>24 hours) to add a blacklist:
Monkey--pkg-blacklist-file/mnt/sdcard/blacklist.txt--throttle--ignore-crashes--ignore-timeouts-- Ignore-security-exceptions--ignore-native-crashes--monitor-native-crashes-s 1000-v-v-v 360000 1 >>/mnt/sdcar D/stability_base.txt 2>>/mnt/sdcard/stability_base_err.txt

Run the Single apk command (>24 hours):
Monkey--pkg-whitelist-file/mnt/sdcard/whitelist.txt--throttle--ignore-crashes--ignore-timeouts-- Ignore-security-exceptions--ignore-native-crashes--monitor-native-crashes-s 1000-v-v-v 360000 1 >>/mnt/sdcar D/stability_base.txt 2>>/mnt/sdcard/stability_base_err.txt


Note: When running a single apk, always remember to put a whitelist file in the root directory of the mobile phone: whitelist.txt,txt text write to the module to be measured APK app package name can be said to run only the specified APK, If you put blacklist.txt in the root directory of your phone, fill in the appropriate package name and run all the apps you specified on Blacklist.txt. Monkey run finished check log inside whether there is crash, ANR (in the root directory of/mnt/sdcard/stability_base.txt 2>>/mnt/sdcard/stability_base_err.txt)


In fact, just get the phone, will/mnt/sdcard into Whitelist.txt or blacklist.txt, put on the application package name, and then the ADB shell---"mokey named, you can


Command explanation:

Parameters:--throttle < ms >

Used to specify the delay between user actions (that is, events), in milliseconds;

Parameter:--ignore-crashes

Lets you specify whether monkey stops running when the application crashes (force & Close error). If you use this parameter, even if the application crashes, monkey will still send the event, straight

To the event count is complete.
Parameter:--ignore-timeouts

Used to specify whether monkey stops running when an application has a ANR (application No responding) error. If you use this parameter, monkey will still send events until the event count is complete, even if the application has a ANR error.
Parameter:--ignore-security-exceptions

Used to specify whether monkey stops running when an application has a licensing error (such as certificate licensing, network licensing, and so on). If you use this parameter, monkey will still send events until the event count is complete, even if the application has a licensing error.

Parameter: ignore-native-crashes
Crashes caused by ignoring local code. After setting is ignored, Monkey will execute all events and will not stop

Parameter:--monitor-native-crashes

Used to specify whether to monitor and report local code for application crashes.

Parameter:-S
Used to specify the seed value of the pseudo-random number generator, and if the seed is the same, the sequence of events produced by the two monkey tests is the same. Example:
Monkey test 1:adb Shell monkey-p COM.HTC.WEATHER–S10 100

Monkey test 2:adb Shell monkey-p com.htc.weather–s 10 100
The effect of the two Tests is the same, because the simulated sequence of user actions (a sequence of operations consisting of each operation in a certain order) is the same. The sequence of operations is randomly generated, but as long as we specify the same seed value, we can guarantee that the random sequence of operations generated by the two Tests is exactly the same, so this sequence of operations is pseudo-random;


Parameter:-V

Used to specify the level of feedback information (the level of information is the verbosity of the log), with a total of 3 levels, respectively, with the corresponding parameters as shown in the following table:

Log levels Level 0

Sample adb shell monkey-p com.htc.weather–v 100

Describe default values, providing only small amounts of information such as startup hints, test completion, and final results

Log levels Level 1

Sample adb shell monkey-p com.htc.weather–v-v 100

Description provides a more detailed log, including each event message sent to the activity

Log Levels Level 2

Sample adb shell monkey-p com.htc.weather–v-v–v 100

Description of the most detailed log, including the selected/unchecked activity information in the test

Monkey test mobile phone bug reproduction and resolution method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.