当前位置:网站首页>Chapter IX app project test (2) test tools
Chapter IX app project test (2) test tools
2022-06-25 04:41:00 【zhhzc】
9.4 APP Testing tools
Because the limitations of mobile phones bring a lot of inconvenience to the test , So in APP Test relative Web Testing is more concerned with the use of some tools , Introduce to you Android Use of mobile phone test tools .
Android Main directory description of the system , As shown in the table 9-1

9.4.1 ADB Tool is introduced
ADB(Android Debug Bridge Abbreviation ) yes Android SDK There is a multi-purpose debugging tool , Can pass ADB To manage the state of the device or emulator .ADB Tools by 3 Components ;
1) Client running on the computer .PC The client mainly communicates with the simulator or device through the client .
2) A server that runs as a background process on a computer . Responsible for managing client and emulator or on device adbd Interprocess communication .
3) Daemon adb Run on the simulator or device in the form of a background process .
When a ADB client , The client first confirms whether there is a ADB The server process is running . If there is no process , Then start the server process . When ADB Server running , Will be bound to the local TCP port 5037, And monitor ADB Command from client . The server then connects all running emulators or device instances . It will scan all 5554~5584 To locate all emulators or devices . Once the server is connected to all simulator instances , have access to ADB Commands control and access the device . General format for sending commands :adb-s Device command ( Through the command adb devices Get the device name )
Use ADB It can mainly complete the following functions :
1) It can quickly update the software on the device or simulator ;
2) Can run on a device or simulator shell command
3) You can synchronize files on your device or emulator 、 Upload 、 Download the file ;
4) It can be captured in real time APP Runtime Log Information .
2、ADB Tool installation process ( skip )
3、ADB Basic command Introduction
(1)adb device
adb device: Query the connected device or emulator , Use adb You need to query before adb Whether it is connected to the device or simulator . Enter the command... In the command prompt window :adb device Press (Enter) key , After running the command , The following message appears to indicate that you are connected to the device , Pictured 9-4 Shown .

command adb device After operation 3 States , as follows :
device: Indicates that the device is found and connected with adb Connected to the
no device: Indicates that no simulator is currently running , Or no device found
offline: Indicates that the device or emulator is not connected to adb Connected or unresponsive
If there are more than one device when , Indicates that there are currently multiple devices or simulators running . At this time to use adb when , Need to use -s Specify a target device . The command format is as follows :
adb-s Target device name command
(2) adb install
adb install: Used to install software to the device . The command format is as follows :adb install[ption]<path>
Such as :adb install D:\TensonCourse.apk After running the command Success, Indicates successful installation on the device or emulator .
(3)adb uninstall
adb uninstall: Used to uninstall the software on the device . The naming format is as follows :adb uninstall[option]<package>
(4)adb pull
adb pull: Copy files from the device or emulator to PC End . The command format is as follows :adb pull<remote><local>
Such as :adb pull init.rc command , Indicates... On the device init.rc Copy the file to the local current directory (init.rc Represents the file in the device ,. Express PC End current directory )
(5)adb push
adb push: take PC Copy the end file to the device or simulator . The command format is as follows :adb push <local><remote>
Such as :adb push D:\tenson.txt/sdcard/ command , Means to copy files to the device /sdcard/ Under the table of contents .
(6) adb logcat
adb logcat: For grabbing log Track information Bug track . The command format is as follows :
adb logcat[option][filter-spec]
logcat See table for command options 9-2, The usage is as follows :

adb logcat, It means to capture the whole mobile phone in real time log Information and enter information in the command prompt window .
adb logcat>D:\log.txt, Will be captured in real time log Information and save it locally log.txt file .
adb logcat-v time>D:\log.txt, Acquired log.txt Add time information to the file .
adb logcat-b radio>D:\log.txt, Obtain network RF information .
adb logcat-b events>D:\log.txt, Get event messages
adb logcat-v time-b main-b radio-b system>logcat.txt Commonly used , obtain log Information plus time information , It mainly displays the buffer and the logs related to the phone and system .
logcat See table for command filtering 9-3

Besides adb logcat It can be used to filter and set filter content , You can also filter content in conjunction with matching regular expressions .
notes : When the application or system is rebooted or crashed abnormally, it grabs log
adb bugreport obtain bugreport Information .bugreport Record android Of the startup process log, And the state of the system after startup , Include a list of processes 、 Memory information 、VM Information, etc .
adb shell dumpsys dropbox-print obtain dropbox Information . Record the occurrence of exceptions and other information , Used to analyze crash、 Restart, etc. .
adb pull/data/anr/ obtain anr Information , Grab the information file when the system or application responds .
(7)adb shell
Provides shell terminal , adopt shell The terminal can run various commands on the simulator or equipment , These orders are linux shell A subset of . Can pass adb shell Command to use these commands , such as :adb shell ls,, You can also use the command first :adb shell Access to the device or simulator shell terminal , Then use the corresponding command . When the device is shell State, , It can be used exit To quit shell terminal .
adb shell dumpsys battery
function : Check the information about the battery level . After entering this command , Occurrence map 9-5 Shown .

In the figure 9-5 in , The description of the display is as follows :
AC powered:true Indicates power supply
USB powered:true: Said the use of usb Power supply
status:5 Indicates that the battery is full , in total 5 Level
health:2 Battery health , Yes 6 It's worth , Namely 0 and 1 Indicates an unknown state ,2 It means good ,3 Indicates overheating ,4 Indicates damage ,5 Indicates overvoltage .
present:true Indicates that there is a battery on the mobile phone
level:100 Indicates that the remaining battery capacity is 100%
scale:100 Indicates that the maximum battery capacity is 100%
voltage:3800 Indicates the current battery voltage value , The normal range should be 4350 Inside
voltage:3800 Indicates the current battery temperature value ,300 Express 30 degree , The range is generally in 300~380 Between .
technology:li-ion It is the technical standard of battery ,Li-ion Indicates lithium battery .
adb shell dumpsys wifi function : see WIFI Internet Information . Meaning of content :wi-fi is enabled, Express wifi In the connected state , share 5 States ;
disabled: close , disabling: Shutting down enabled: Connected enabling: Starting .unknown: Unknown status Internal state: contain WIFI Device name 、 state IP Address ,MAC Address , Network encryption method and other information .
adb shell dumpsys power : function Refer to power management related information . The content display information includes ower Manager State
Settings and Configuration,UID states Wireless Charger DetectorState Etc .
If you want to read a message alone , You can add find Command to find . For example, check the screen closing time , Need to find “mScreen OffTimeout Setting" value , The order is as follows :adb shell dumpsys power find "mScreen OffTimeout setting" The results are as follows ,60000 Express 60s, Namely 1min
adb shell dumpsys cpuinfo function : see CPU Dynamic occupancy of , Press CPU The usage rate can be ranked from large to small
command :adb shell top-m5- n 10-s cpu You can also refer to CPU Occupancy rate , After the operation, the figure is displayed 9-6 Shown .

Parameter description :
-m: Displays the number of processes
-n: The number of times the data is refreshed
-s: Sort by description
-d: Refresh interval , Default 5s
adb shell dumpstate function : View the current status of the system . The information includes : System build version information 、
Internet related information 、 Kernel related information 、 Runtime information 、 Memory usage 、CPU usage 、 Process related information, etc .
notes : A lot of information is displayed , For easy viewing , Finally, reset the wizard to a file .
adb shell dmesg function : View kernel log information
adb shell df function : View the different information of the mobile phone system
adb shell getprop gsm.network.type function : Get mobile network type information
adb shell getprop ro.build.version.release function : Get the mobile phone system version information
adb shell cat/proc/cpuinfo function : View memory related information . among memtotal Indicates the total running memory ,MemFree Indicates the remaining memory .
adb shell cat/proc/version function : Get the device kernel version information
adb shell cat/proc/net/xt qtaguid/stats function : View mobile traffic data . There is a lot of content information , Each line represents the traffic information obtained each time , Including data sent and received , Focus on : The fourth column represents UID( The user who runs the application ID), The sixth column indicates the amount of data received , The eighth column indicates the amount of data sent .
(8)adb Details of other commands
adb get-serialno function : Get the serial number of the device
adb get state, function : View the current status of the device or emulator , among device Indicates that it is connected
adb statt-server, function : close adb The server , When abd The state is unstable , Available shutdown adb
adb shell am(Activity Manager) function : Simulate the actions of some operating equipment
adb shell pm(package manager) function : Query the application on the device
executive summary adb More orders , Just remember the common commands .
边栏推荐
- Use text analysis to identify the main gender in a text
- dotnet-exec 0.4.0 released
- PostgreSQL数据库WAL——RM_HEAP_ID日志记录动作
- Immutable學習之路----告別傳統拷貝
- CTF_ Variable coverage in web:php
- Codeforces Round #802 (Div. 2) C D
- Trigger for gbase 8s
- GBASE 8s的并行操作问题场景描述
- GBASE 8s的触发器
- Coordinate system left multiply right multiply
猜你喜欢
随机推荐
Gbase 8s index R tree
WPF 使用 MAUI 的自绘制逻辑
哪个编程语言实现hello world最烦琐?
CTF_ Web: how to recognize and evaluate a regular expression
Easyrecovery15 very easy to use computer data recovery software
After the newly assigned variable of the applet is modified, the original variable will also be modified
Excel exports data to SQL and pictures to folder through macro | VBA
GBase 8s 锁的分类
OOP 向量加减(友元+拷贝构造)
CTF_ Variable coverage in web:php
How to apply for software
CTF_ Web: deserialization of learning notes (II) CTF classic test questions from shallow to deep
Office macro virus bounce shell experiment
[Flink] problems and solutions of the continuous growth of checkpoint size in rocksdb incremental mode
CTF_ Web: advanced problem WP (5-8) of attack and defense world expert zone
【无标题】
CTF_ Web: deserialization learning notes (I) classes and objects in PHP
Bingbing's learning notes: implementation of circular queue
515. 在每个树行中找最大值 / 剑指 Offer II 095. 最长公共子序列
515. find the maximum value / Sword finger offer II 095 in each tree row Longest common subsequence









