cmd with the monkey test

monkey testing related commands

monkey is simulated user touch operation judgment condition is not supported.
monkey Format: 
Start Andrews emulator / real machine
Click Run -> CMD-> into the command line interface
to view the state of the connection, adb devices
enter command line interface monkey 
-p constraints for a limited, just a test an app
   the adb the shell Monkey - as the test machine
   adb shell monkey -p [package name] 100 (number of triggers) as a test app
        -s abnormal use for reproduction          
           [package names] adb shell monkey -p -s 100 99 
        log level -v for specifying the feedback information are three levels of total
           -v is a level0
           -v level-1 -v 
           -v -v -v Level2
           the adb the shell Monkey -p [package names] -s 100 -v -v -v 99 display the log information
           adb shell monkey -p [package names] -s 100 -v -v -v 99> D: \ monkey.txt log saved locally
        --throttle <milliseconds> click time for extended
           adb shell monkey -p [package names] -s -v -v -v --thrrottle 100 500 99> D: \ monkey.txt
        --randomize-throttle insert a random delay between the event random delay range is 0 to throttle is provided given time, in milliseconds
        --pkg-whitelist-file white list, followed by the txt file
           command whitelist pushed to the phone, adb push <local file path> / data / local / tmp 
           command adb shell monkey - -pkg-whitelist-file /data/local/tmp/whitelist.txt 100 ( 100 refers to the number of tests)
       --pkg-file-blacklist blacklist, followed by the txt file
           command whitelist pushed to the phone, the adb push <local file path> / data / local / tmp 
           command adb shell monkey --pkg-blacklist-file /data/local/tmp/whitelist.txt 100 (100 refers to the number of tests)
       Monkey common parameters - percentage of events
        - -pct-touch {+} percentage: 0
   translation touch, touch event refers to a down-up event occurred at a particular location, click on
Monkey the shell -p-PCT cn.trichat.angus999 the adb Touch-10 10

-PCT-Motion percentage {+}: a
   post-translational action, action event took refers (i.e. down event) from one location through a series of after the pseudo-random event pop-up (i.e. up event)
-PCT-pinchzoom {+} percentage: 2
   translation finger zoom, zoom-out gesture on the smart machine operation events
--pct-trackball {+} percentages: 3
   translation track, track events includes a series of random movement, and occasionally follows, in moving click event
--pct-rotation {+} percentage: 4
   translation screen rotation, horizontal screen vertical screen event
--pct-nav {+} percentage: 5
       translation basic navigation , the basic navigation event from the main direction of the input device, down, left, and right event
--pct-majornav {+} percentage: 6
   translation main navigation, the main navigation event generally refers to a graphical interface trigger some action, such as a keyboard key intermediate, return key, a menu key, etc.
--pct-syskeys {+} percentage: 7
   translation system key, the system key event generally refers only to retain the keys used by the system, such as the HOME key, the BACK key, dial keys End key, a volume key, etc.
--pct-appswitch {+} percentage: 8
   Translation start application, an application launch event (activity launches) opens the application by calling startActivity () method to maximize all open applications in the Package
-PCT-Flip percentage of {+}: 9
   Translation flip flick percentage keyboard, the clicking the input box, pop-up keyboard, clicking a region other than the input box, a keyboard recover
        --pct-anyevent {+} percentage: 10
   translate other type, other types of events above refers to all other events involved are not, such as KeyPress, not used the button, etc. 

 

 

Log Analysis

 Command:
  adb Devices - detecting device  
      list of devices attached device list
  adb Connect 127.0.0.1:62001
     - for connecting the device simulator
  adb pull <Mobile File Path> <local path>  
     - copy a file from the local mobile terminal to
  adb Push <local path file> <path Mobile> 
     - copy a file from the local side to the mobile terminal
  
  adb logcat printing log
     adb logcat> D: logcat.log for outputting the log to the local path then terminates ctrl + log will logcat. log in
  adb install xxx.pak install apk command, success has been in accordance with the instructions better.
  
  adb uninstall com.tencent.mobileqq - uninstalling
  
  adb uninstall -k com.tencent.mobileqq - uninstall the application but keep the data and cache files

  adb shell dumpsys activity | find mFocusedActivity - view the foreground application activity name (two days before the upgrade from Android 7.0 to Android 8.0, today with adb shell dumpsys activity | when findstr "mFocusedActivity" to get the current active activity, nothing found get, and later learned that Baidu, the command change, and should use adb shell dumpsys activity | findstr "mResumedActivity ")
  
  national cattle package name: cn.trichat.angus999
  adb connect / disconnect the phone connection for remote debugging over wifi
  
  adb tcpip 5555 to determine end mobile phones and computer terminals wifi communication port. Wifi connection for remote


logcat log file analysis command

  adb logcat -b radio - grabbed the specific module log without -b radio default grabbed the main log
  Radio: log output communication system, such as: wifi, Bluetooth Class
  System: log output system components such as: If you want to call camera, a microphone
  events: event module log output event module, such as a finger click event.
  Main: log all java layers (layers not log 3 above)

  logcat log consists of five parts:
  1. Write the time the log, such as: 2019-05-11 15:50:15
  2. priority in Android, the priority of the log from low to high, following
    V-Verbose (long-winded, some detailed information about the minimum level of development and debugging, use only in development, not in publishing products)
    D-debug (debug information for debugging, you can turn off the release of the product, the more common)
    the I-info (information, general informational messages)
    W-Warnlng (warning)  
    E-error (error has occurred that may affect operation error, such as the output of log application Crash)
  3. tag (tag), conveniently indicated log or log filter initiator screening, I / admin of ADMIN 
  4.PID (process ID), such as I / admin (491 )
  5. text, the main content of this log
  
  logging program for key generation crash, the crash can search: FATAL EXCEPTION
  for no response procedures, to determine the position of the foreground application ANR activity by looking at the name, while, through the ANR occurs, the information is recorded to a path: /data/anr/traces.txt in, traces can only keep the most recent time the ANR
  for many times without responding, can go to the / data / system / dropbox find in ANR, while Too ls -l to view the log was created 
 

Perform the test:

The file reached the end of the phone
adb push C: \ Users \ Administrator \ Desktop \ monkeyScriptMain.txt / sdcard /

start automated testing
adb shell monkey -f /sdcard/monkeyScriptMain.txt -v -v -v  1> D: log.txt

Guess you like

Origin www.cnblogs.com/chengganghua/p/10938516.html