Android app test test of Money

A, Monkey Features

1, the timing of operation: generally the product is stable after the first round of functional testing done at night

2, need to know packageName

3. Objective: The main test products if there is a crash and ANR problems.

Second, the two methods to obtain the package name

Want to first install the acquired packages simulator: adb <package name with path> install

1, obtained by logcat adb 
adb shell "logcat | grep the START" [If you do not appear directly log, you can first enter linux command: adb shell, then execute: logcat | grep START]
and then open the apk, you can emerge the package name

2、aapt  dump badging apk名称

Third, the basic command of the Monkey

1, the standard monkey command: adb shell monkey -p com.android.calculator2 -v 50

-p:packageName

-v: Log Level

50: Number of incidents

2、adb shell monkey -p com.android.calculator2 -v -v --pct-touch 50 --throttle 600 88

--pct-touch 50 to set the whole process in the percentage of clicks

--throttle 600 per event interval 600ms

3、adb shell monkey -p packagename --throttle 500 --ignore-crashes --ignore-timeouts --ignoresecurity-exceptions --ignore-native-crashes --monitor-native-crashes -v -v -v 1000000>c:\monkey_test.log

 --ignore-crashes used to specify when (Force & Close error) application crashes, Monkey whether to stop the run. If you use this parameter, even if the application crashes, Monkey will still send events until the event count is completed.

--ignore-timeouts used to specify when the application occurs ANR (Application No Responding) errors, Monkey whether to stop the run. If you use this parameter, ANR even if the application error occurs, Monkey will still send events until the event count is completed. 

--ignore-security-exceptions is used to specify when (such as a certificate license, network license, etc.) permit application error occurs, Monkey whether to stop the run. If you use this parameter, even if the application error occurred license Monkey will still send events until the event count is completed. 

--kill-process-after-error is used to specify when an application error has occurred, whether to stop its operation. If specified, when an application error occurs, the application stops running and maintaining the current status (Note: The application is still only at the time the error occurred, the system does not end the process of the application).

--monitor-native-crashes specifies whether the monitor and report the application of a crash occurring native code

Four, Monkey log level

Parameters: -v feedback information is used to specify the level (level of detail is the level information of the log), a total of three sub-levels, respectively corresponding to the parameters as follows:

1, the log level Level0

      Example adb shellmonkey -p com.htc.Weather -v 100 

      Description Default value, only a small amount of information on the boot prompt, complete and final test results, etc.

2, log levels Level 1

      Example adb shell monkey -p com.htc.Weather -v -v 100 

      Description Provides more detailed logs, including event information is sent to each of Activity

3, log level Level 2

      Example adb shell monkey -p com.htc.Weather -v -v -v 100

      The most detailed description of the log, including the test checked / unchecked Activity Information

Five, Monkey type of event

1, - pct-touch: the specified percentage of the touch event, such as: - pct-touch 5

2, --pct-motion (sliding events)

3, --pct-trackball (trackball event)

4, --pct-nav (navigation event up / down / left / right)

5, --pct-majornav (main navigation event back key, menu key)

6, --pct-syskeys (system key events Home, Back, startCall, endCall, volumeControl)

7, --pct-appswitch (switching between Activity)

8, - pct-anyevent (in any event)

 Six, Monkey parameters -s 

Parameters: -s specifies the pseudo-random number generator seed value, the sequence of events if the same seed, the two test Monkey also produced the same. Example:

Monkey Test 1: adb shell monkey -p com.htc.Weather -s 10 100

Monkey Test 2: adb shell monkey -p com.htc.Weather-s 10 100 two tests results are the same as the operation sequence of simulated users (a series of operations for each operation consisting in certain sequence, i.e., a sequence) is the same. Although the sequence of operations is randomly generated, but if we specify the same Seed value, to ensure that the random sequence of operations can generate two tests are identical, so the operation of the pseudo random sequence;

Seven log analysis of the Monkey

1, by keyword search, ANR, Exception, Crash, Error. 

2, find problem areas, see the context information. 

3, note that the first switch context information. 

4, some of the events before the action inside to view the monkey error, you can perform this action manually.

5, the problem recurring, monkey executed before the command can be used in the execution again, pay attention to the same seed value.

[Analysis Test Results]

(1), ANR problem (unresponsive): Search for "ANR" in the log (application no response)

(2), flash back problem: the log search "crash"

(3), exception: Search for "exception"

(4), Force Quit: Search for "force closed"

Eight, Crash special

1, the installation can cause App Crash

2, execute the command pressure

3, extract the Exception information Crash

Case: perform stress tests and generates monkey_test.log log files.

#adb shell monkey -p cn.besttest.crashtest -v 100 >E:\monkey\monkey_test.log  

Under # View E disk folder has been generated monkey_test.log.

# Open files, crash analysis

Nine, ANR special

Steps above

1, the installation can cause App ANR

2, execute the command pressure

3, the ANR extract information Exception

 

1, see the monkey's log 

2、/data/anr/traces.txt

3. Check logcat log ANR

 

      

 

Guess you like

Origin www.cnblogs.com/wuzm/p/10963979.html