MindMap Gallery Notes and mind map of Mastering Mobile App Testing Practice
"Mastering Mobile App Testing Practical Practice" includes mind maps, reading notes, and knowledge summaries, including an introduction to the basics of the Android system, the basics of the Junit framework, ADB commands, Monkey tools, etc.
Edited at 2023-11-03 10:51:14This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
"Mastering Mobile App Testing Practice"
Chapter 1 Introduction to the basic contents of Android system
system structure
application layer
application framework layer
System runtime layer
Linux kernel layer
Chapter 2 Junit Framework Basics
Chapter 3 ADB Commands
Android Debug Bridge
ADB related instructions
adb devices
View device related information
The first column is the serial number of the device
The second column of the device status information
device status
The device or emulator is connected to the adb server
offline status
The device or emulator is not connected to the adb server or is not responding
no device status
No physical device or emulator connection
adb install
-s
Specify device
adb -s physical mobile phone device serial number/mobile phone simulator device serial number install installation package path
-r
Overwrite originally installed software and preserve data
adb uninstall
-s
Specify device
adb -s physical mobile phone device serial number/mobile phone simulator device serial number uninstall application package name
-k
Keep configuration and cache files of uninstalled software
adb -s physical mobile phone device serial number/mobile phone simulator device serial number shell pm uninstall -k application package name
adb pull
Transfer files from device to computer
adb pull file path in the device path in the computer
-s
Specify device
adb -s physical mobile phone device serial number/mobile phone simulator device serial number pull file path in the device path in the computer
adb push
Transfer files from computer to device
adb push file path in computer path in device
-s
Specify device
adb -s physical mobile phone device serial number/mobile phone simulator device serial number push file path in computer path in device
adb shell
Supports common Linux commands, saved in the /system/bin file
Example adb shell ls
adb shell
su root
cd /data/data
ls
Check which applications are installed on the phone. What is displayed is the application package name.
adb shell dumpsys battery
View information about battery power
AC powered:flase
Whether to connect the power supply
flase indicates that no power supply is used
USB powered: true
Whether to use USB power supply
true means using USB power supply
status:5
battery charge status
5 means fully charged
health:2
Battery health
2 means the battery is in good condition
level:100
Current remaining battery information
100% means fully charged
scale:100
Maximum battery power
Usually this value is 100 because the battery level is displayed as a percentage
voltage:4332
Current battery voltage
4322 millivolts (mv)
temperature:314
Current battery temperature
31.4 degrees, the unit is 0.1 degrees
technology:Li-ion
Battery technology used
Li-ion means lithium battery
adb shell dumpsys wifi
View wireless network information
You can add the "|more" parameter to pause the output when the output information displays a full page. You can press the space button to continue displaying the next page, or press "Q" to stop displaying subsequent output information.
Five WiFi connection statuses
disabledclosed
disabling is closing
enabledEnabled
enabling is starting
unknownunknown
adb shell dumpsys power
View information about power management
Add "findstr" or "grep" filtering to Windows systems
Add "grep" to Linux system
mScreenOffTimeoutSetting screen off time, in milliseconds
adb shell dumpsys telephony.registry
View phone related information
mCallState
Outgoing call status
0: Standby state
1: The incoming call has not been answered yet
2: The phone is busy
mCallIncomingNumber
Phone number of last call
mServiceState
Service status
0:Normal use status
1: The phone is not connected to any telecom operator network
2: The phone can only make emergency calls.
3:The phone is turned off
mSignalStrength
signal strength information
mMessageWaiting
Are you waiting for a radio message?
mCallForwarding
Whether call forwarding is enabled
mDataActivity
Wireless data call status
0: No call
1: Receiving IP PPP signal
2: Sending IP PPP signal
3: Sending and receiving IP PPP signals
mDataConnectionState
Wireless data connection
0: No data connection
1:Creating data connection
2: Connected
3: Suspended state, the number connection has been created, but the IP data communication is temporarily unavailable.
mDataConnectionPossible
Is there a data connection?
mDataConnnectionReason
Reason for data connection
mDataConnectionApn
APN (Access Point Name) access point name
mDataConnectionLinkProperties
Link properties for data connections
mDataConnectionLinkCapabilities
Data link connectivity capabilities
mCellLocation
Base station related information
registrations
Number of registration records
adb shell cat /proc/cpuinfo
The /proc partition saves various real-time information of the system, such as CPU, memory, etc.
View information about CPU hardware
adb shell cat /proc/meminfo
View memory related information
adb shell cat /proc/iomem
View information about I/O memory partitions
adb shell cat /system/build.prop | findstr "ro.product.model"
Get mobile phone model information
adb shell cat /proc/cpuinfo | findstr "Processor"
Get phone processor information
adb shell cat /proc/meminfo | findstr "MemTotal"
Get phone memory information
adb shell dumpsys window | findstr "Display"
Get information about mobile phone screen resolution
adb shell getprop ro.build.version.release
Get information about the mobile phone system version
adb shell cat /proc/version
Get information about the mobile phone kernel version
adb shell getprop gsm.operator.alpha
Get information about mobile phone operators
adb shell getprop gsm.network.type
Get information about mobile network type
adb shell dumpsys iphonesubinfo | findstr "Device ID"
Get information about mobile phone serial number
adb shell df
Obtain relevant information about each partition of the mobile phone's Android system
adb shell dmesg
Output the ring buffer information of the Linux kernel and obtain a large amount of system information at multiple operating levels such as system architecture, CPU, mounted hardware, RAM, etc.
Common Phrases Diagnosis of Equipment Faults
Prompt for insufficient permissions
adb shell
su root
dmesg > /sdcard/log.txt
Redirect
adb shell dumpstate
Obtain relevant information about the current status of the mobile phone's Android system
Including system build version information, network-related information, system kernel-related information, normal running time information, memory usage information, CPU usage information, process-related information, running application/service list-related information, and system-related information. Information about installed application packages
adb get-serialno
Get the serial number of the device
adb get-state
View the current status of your device
3 medium status
device status
offline status
no device status
adb logcat
View and track system log buffer information
log level
V
redundancy level
D
debug level
I
information level
W
warning level
E
error level
adb logcat *:W
Output logs whose level is greater than "warning" level, that is: W, E
The log has multiple circular buffers
radio
View buffer messages containing wireless/telephone related
events
View time-related messages
main
View messages related to the main buffer
adb logcat -b main
View main buffer
adb bugreport
View the log information of the Android startup process and the system status after startup, including process list, memory information, VM information, etc.
adb jdwp
List the JDWP-related process IDs of the specified device
JDWP: Java Debug Wire Protocol, which is the JAVA debugger wireless protocol, which defines the communication protocol between the debugger (Debugger) and the debugged JAVA virtual machine (Target VM)
JDWP only defines the format of data transmission and does not specify the specific transmission method.
adb start-server
Enable adb service
adb kill-server
Close adb service
adb forward
Redirect the local port to the device port
adb forward tcp: 2211 tcp: 5566
All data sent to port 2211 will be forwarded to port 5566
am
Full name: Activity Manager
Can be used to simulate the behavior of various systems
Example: adb shell am start -n com.sec.android.app.camera/.Camera starts the camera function of Samsung mobile phone
Example: adb shell am broadcast -a android.intent.action.BATTERY_CHANGED --ei "level" 5 --ei "sacle" 100 sends a message to the mobile phone to simulate the low battery of the mobile phone (sends the message of the remaining 5% battery, wait a few seconds Automatically restores to actual value after ten seconds)
pm
Full name: package manager
Can be used to simulate android behavior or query applications on the device, etc.
Example: adb shell pm list packages prints all package list information
Example: adb shell pm list packages -f to view its associated information, that is, the location of the application apk and the corresponding package name
Other parameters
-d
View disabled packages
-e
View enabled packages
-s
View system packages
-3
View third-party packages
-i
View the corresponding installer of the package
-u
View packages that have been uninstalled
Telnet
Turn on and enable
Control Panel-Programs and Features-Turn Windows features on or off-Telnet client
Enter "Telnet" on the console to enable, press "quit" to exit.
help to view supported commands
gsm call 13888888888
Call the device at 13888888888
sms 13888888888 hi,tester
Send a "hi, tester" text message to the device
network
help network
View its help information
help command
View command-related usage
network status
View network status information
Including information on uplink and downlink speeds and maximum and minimum delays.
network speed
Dynamically set the device’s network speed
network speed 14.4:20
Set the uplink speed to 14.4Kb and the downlink speed to 20Kb
After network speed, you can add the following value
gsm
GSM/CSD; UP:14.4,DOWN:14.4
hscsd
HSCSD;UP:14.4,DOWN:43.2
gprs
GPRS; UP:40.0,DOWN:80.0
edge
EDGE/EGPRS; UP:118.4,DOWN:236.8
umts
UMTS/3G;UP:128.0,DOWN:1920.0
hsdpa
HSDPA; UP:348.0,DOWN:14400.0
full
Unlimited; UP:0.0; DOWN:0.0
<num>
Set an explicit speed common to both uplink and downlink
<up>:<down>
Set explicit speeds for uplink and downlink respectively
network delay
Dynamically set the network delay of the device
network delay 5 sets the network delay to 5 milliseconds
network capture start/stop file name
Dynamically capture device network packets
network capture start file name
Start capturing packets
network capture stop file name
Stop capturing packets
windows scale 0.5
Reduce the size of the simulator to half its original size
Chapter 4 Monkey Tool
adb shell monkey
-p
Specify the package to run
adb shell monkey -p package name times
Send xx random times to the app with XX package name
-v
Specify the verbosity level of printing information. Each additional "-v" will increase the verbosity level of the information.
1 "-v": The default information verbosity level is 0, which will print some events sent to the Activity under test during test execution.
2 "-v": The default information detail level is 1, the printed information is more comprehensive, and which activities are selected will be output in the information.
3 "-v": The default information detail level is 2, and the printed information is the most comprehensive. Not only does it add information about which activities are selected, but also information about which applications have been installed but have not been selected is also output.
adb shell monkey -v -v -v -p package name times
No random seed (-s parameter) is specified, and the default seed used is 0 (i.e. seed=0)
Event related parameter table
-s <seed>
The seed value of the pseudo-random number generator. If you run the same Monkey command again with the same random seed value, the two executions will generate the same sequence of events.
--throttle <milliseconds>
Set a fixed delay to be inserted between two events, which can slow down the execution of Monkey. If this option is not specified, Monkey will not be delayed and events will generate and send messages as quickly as possible.
adb shell monkey -p package name--throttle 3000 100
The interval is 3000ms
--pct-touch <percent>
Set the percentage of touch screen event generation. A touch screen event is a gesture with finger press and lift events.
adb shell monkey --pct-touch 50 -p package name --throttle 3000 100
The proportion of touch screen events is 50%
--pct-motion <percent>
Set the percentage of sliding events generated. A sliding event is a gesture in which a finger is pressed down at a certain position, slid a certain distance and then raised.
adb shell monkey --pct-motion 50 -p package name --throttle 3000 100
Sliding events account for 50%
--pct-trackball <percent>
Sets the percentage of trackball event generation. Trackball events are events that contain a series of random movements and stand-alone events
adb shell monkey --pct-trackball 50 -p package name --throttle 3000 100
Trackball events account for 50%
--pcet-nav <percent>
Set the percentage of basic navigation events. Basic navigation events are events that simulate directional device input up/down/left/right.
adb shell monkey --pct-nav 50 -p package name --throttle 3000 100
Navigation events account for 50%
--pct-majornav <percent>
Set the percentage of main navigation events. Main navigation events usually cause the UI to generate feedback events, such as: stand-alone BACK key, MENU key
adb shell monkey --pct-majornav 50 -p package name --throttle 3000 100
Major navigation events account for 50%
--pct-syskeys <percent>
Set the percentage of system key events. System keys refer to these keys that are usually reserved and used by the system, such as HOME, BACK, dial, hang up, and volume control keys.
adb shell monkey --pct-syskeys 50-p package name --throttle 3000 100
System key events account for 50%
--pct-appswitch <percent>
Sets the percentage of active events that are initiated. After a random interval, Monkey will execute a startActivity() function to cover as many activities in the package as possible
adb shell monkey --pct-appswitch 50 -p package name --throttle 3000 100
The proportion of startup activity events is 50%
--pct-anyevent <percent>
Set the percentage of other types of events, such as ordinary key messages, uncommon device button events, etc.
adb shell monkey --pct-anyevent 50 -p package name --throttle 3000 100
Other types of events account for 50%
Restrictions
-p <list of allowed package names>
Set one or several packages, and Monkey will only allow the system to start activities in these packages. To specify multiple packages, you need to use multiple "-p" options. Each "-p" option can only be used for one package.
-c <category of intent>
Specify the classification of the intent so that Monkey will only launch activities that can handle these kinds of intents. If this option is not set, Monkey will only start with Intent.CATEGORY_LAUNCHER and Intent.CATEGORY_Monkey. Similar to the "-p" parameter, to specify multiple categories, multiple "-c" options need to be used. Each "-c" option can only be used for one category.
Debugging options
--dbg-no-events
If this parameter is specified, Monkey will perform initial startup and enter a test Activity without generating further events. For best results, use it with the "-v", "-p" and "--throttle" parameters. And let Monkey run for 30s or more, so that we can observe the switching process between packages called by the application.
--hprof
If this parameter is specified, Monkey will generate a performance analysis report before and after sending the event sequence. Usually a file of about 5MB in size will be generated in the "data/misc" directory.
--ignore-crashes
Normally, Monkey will stop running after the application under test crashes or any exception occurs. If this parameter is specified, Monkey will continue to send events to the system after an exception occurs until all specified event messages are completed.
adb shell monkey -p package name --ignore-crashes 100
--ignore-timeouts
Normally, Monkey will stop running when any supermarket error occurs in the application (such as "Application Not Responding" dialog box). If this parameter is specified, Monkey will continue to send events to the system after generating an error message until all specified event messages are completed.
adb shell monkey -p package name --ignore-timeouts 100
--ignore-security-exceptions
Normally, Monkey will stop running when a permissions error occurs in the application under test. If this parameter is specified, Monkey will continue to send events to the system until all specified event messages are completed.
adb shell monkey -p package name --ignore-security-exceptions 100
--kill-process-afer-error
Normally, when Monkey stops due to an error, the offending application continues to run. When this option is set, it will notify the system to stop the erroring process
Note: When Monkey is executed normally, it will not close the started application, and the device will still retain the last message status it received. Therefore, it is recommended that in order to maintain the initial state of the application after executing the command, Xu Shoudong or the script program will have been opened. application to close
--monitor-native-crashes
Monitor crashes caused by the Android C/C code part. If the --kill-process-after-error parameter is also specified, the entire system will shut down.
--wait-dbg
After starting Monkey, interrupt its operation and wait for the debugger to connect to it.
adb shell monkey --ignore-crashes --ignore-timeouts --kill-process-after-error --ignore-security-exceptions --throttle 1000 -v -v -v -s 5 100000
Send 100,000 random events to the system. The interval between each random event is 1000ms. Its seed is 5. During the test, relevant security, timeout, crash and other exceptions are ignored.