当前位置:网站首页>Chapter IX app project test (3) test tools
Chapter IX app project test (3) test tools
2022-06-28 03:38:00 【zhhzc】
9.4.2 AAPT
AAPT yes Andriod Asset Packaging Tool Abbreviation , yes Aanriod Apply the resource packaging tool , It can be used AAPT Tool components APK file , It can also be used to list APK Details in the file , Including some group files and resource files AAPT Store in SDK Of build-tools Under the table of contents , When using, you need to set the environment variable path Add AAPT The path of . Because of the configuration adb Environment variables are added when , Or you could just say aapt.exe File copy to platform-tools Under the directory . Introduce to you AAPT Common subcommands for tools .
1、l-list
list List applications *.apk package The content of , Command format :aapt list*.apk;
Example :aapt listD:\notepad.apk Show notepad.apk The contents of the bag .
commonly apk There's a lot in it , It is best to use redirection to direct the contents of the file to a text file , Convenient view . Such as :aapt list D:\notepad.apk>D:\apk.txt
2、d-dump
dump see apk Basic information command format :aapt d values*apk among values The value of... Can be selected .
(1)badging
Parameter description : List the basic information of the application , Include package name package name、 edition 、 Application name .
Example : see lmageViewer.apk Basic information commands for :aapt d badging D:\mageViewer.apk. If you just want to get the package name , You can use the following command aapt d badging D:\tenson.apk findstr"package" The package name obtained through this transmission is com.love-plusplus.demo.image.
(2)permissions
Parameter description : see apk Application permissions for
Example : see tenson.apk Authority ,aapt d permissions D:\tenson.apk.
(3)configurations
Parameter description : Show apk Configuration information , Such as version number , Resolution and other information .
Example : see tenson.apk Configuration information ,aapt d configurations D:\tenson.apk
(4)resources
Parameter description : List the resource information in the application
Example : see tenson.apk Resource information ,aapt d resources D:\tenson.apk
3、 The other parameters
p-package: Package and generate resource package
r-remove: from apk Delete the specified file in the package
a-add: Add files to apk In bag
These parameters can hardly be used for relative tests , If necessary, you can go to Android Official website .
9.4.3 Monkey Tool is introduced
yes Andriod A command-line tool included in , It can run in simulator or equipment . It sends a pseudo-random stream of user events to the system ( Click on 、 touch 、 Gestures, etc ) Implement stress testing on the developing application .Monkey On the surface, it runs on the equipment , Actually, it runs in the terminal of the device , function Monkey The command needs to be preceded by adb shell, You can also enter shell After the terminal, directly input the command to run .
Monkey There are many options , Roughly divided into the following 4 Categories:
1) Basic configuration options , For example, set the number of events
2) Run constraint options , If you set it to test only individual packages
3) Event type and frequency , Such as the proportion of click events and touch screen events and the interval between events .
4) Debugging options , If omitted crashes、ANR etc. .
Monkey The runtime generates events , And send the information to the system ; At the same time, the system under test is also tested , To the following 3 Special treatment for cases .
1) You can specify one or several packages to test
2) The application crashed or received an exception , You can specify the command to let Monkey Continue operation
3) The application is not responding (ANR),Monkey Will stop the application , You can specify the command to let Monkey Continue operation .
2、Monkey Test the usage process
Monkey It is a stability stress testing tool , Usually after the functional test is completed , Conduct stability pressure test . It is mainly used to detect whether the mobile phone is unresponsive 、 Flash back 、 Crash and crash . The main cause of these problems is memory leakage .Monkey The use process of the test , Pictured 9-7 Shown .
First, check the phone memory with commands or tools , And then run Monkey command , Check the phone memory again , If there is an increasing phenomenon , Indicates a memory leak , The problem needs to be solved immediately . At this time, we can use DDMS To analyze the positioning problem .
3、Monkey Basic use of
Basic grammar : adb shell monkey[ Options ]COUNT.. Let's introduce Monkey Parameter options for
-help see monkey Help for . Enter the command at the command line :adb shell monkey-help The result of its operation , Pictured 9-8 Shown .
COUNT Set the number of times the event is executed .
for example :adb shell monkey 1000.
Express monkey Simulate all applications on the device or simulator , Random execution 1000 Secondary user event .
【 Basic parameters 】 There are mainly -p、-v、-s、--throttle etc. .
(1)-p ALLOWED PACKAGE
Parameter description : Specify the application package name to be tested ,monkey Only those in the startup package are allowed Activity, First you can command adb shell ls/data/data/ To see these Activity.
for example :adb shell monkey-pcom.android.calendar 100.
Express monkey On the simulator com.android.calendar application , Random execution 100 Secondary user event .
If you want to specify multiple packages , Need to use multiple -p Options , Every -p Option can only specify one package .
(2)-v
Parameter description : Increase the level of feedback . It is divided into the following 3 A level
-v:Lecel 0: The default value is , Except start prompt 、 Test completion and final results , Provide less information .
-v-v:Lecel 1: Test information that provides information , Such as sending applications one by one Activity Events .
-v-v-v:Lecel 2: Need detailed logs , Including... Selected in the test / Unselected Activity Information .
Example :adb shell monkey-pcom.freshO2O-v-v-v:100
The command is given by 3 individual V, The level of information displayed is Level 2.
(3)-s<seed>
Parameter description : Specifies the seed value of a random number seed, If you use the same seed Run again Monkey The same chronological order will be generated if the seed value is not specified , The system will randomly generate a seed value , In the presence of Bug The seed value will be the same as Bug The information is output together , This is also to facilitate the reproduction of the Bug.
Example :adb shell monkey-pcom.android.music-s 10100
If you run 2 This example , The final result is the same . Because the specified random seed values are 10, The simulated user operation sequence is the same . So the sequence of operations is pseudo-random .
(4)--throttle<ms>
Parameter description : In the event ( The user action ) Insert a fixed delay between , In milliseconds . With this option, you can slow down Monkey Execution speed of . If you don't specify this option ,Monkey Will not be delayed .
Example :adb shell monkey-pcom.android.music--throttle 300100
explain : Specifies that the delay between events is 300ms
【 Debugging options 】 There are mainly --ignore-crashes、--ignore-timeouts、--pkg-blacklist-file、--pkg-whitelist-file、--ignore-security-exceptions--monitor-native-crashes、--kill-process-after-error、--hprof etc. .
(1)--ignore-crashes
Parameter description : Used to specify when an application crashes (crash, perhaps FC),monkey Whether to stop operation . If you use this parameter , Even if the application crashes ,Monkey Events will still be sent , Until the event count is complete .
Example :adb shell monkey-pcom.android.settings--ignore-crashes 1000
During the test , Even if settings Procedure crashes ,monkey Events will continue to be sent , Until the number of events reaches 1000 Mainly .
(2)--ignore-timeouts
Parameter description : Used to specify when an application occurs ANR( The application does not have a corresponding ) when ,monkey Whether to stop operation . If you use this parameter , Even if using the program ANR error ,monkey Events will still be sent , Until the event count is complete .
Example ::adb shell monkey-pcom.android.settings--ignore-timeouts 1000
During the test , Even if the application does not respond ,monkey Events will continue to be sent , Until the number of events reaches 1000 Mainly .
(3)--ignore-security-exceptions
Parameter description : Used to specify when a license error occurs in an application ( If the certificate permits 、 Network license, etc )monkey Whether to stop operation . If you use this parameter , Even if the application has a license error ,monkey Events will still be sent , Until the event count is complete .
adb shell monkey-pcom.android.music--ignore-security-exceptions 1000
During the test , If an application has a licensing error ,monkey Events will continue to be sent until the number of events reaches 1000 until .
(4)--pkg-blacklist-file PACKAGEBLACKLIST FILE
Parameter description : Set application test blacklist , The application packages in the blacklist settings do not participate in the test .
Usage method : stay --Pkg-blacklist-file Followed by the path of the file , This file contains a list of applications that did not participate in the test , You need to put this file push After arriving at the device or simulator , Before you can test . This option is generally used to test the stability of the mobile phone .
(5)--pkg-whitelist-file PACKAGEWHITELIST FILE
Parameter description : Set the test whitelist , Only these applications can be tested , If there are many application packages for testing , You can put these application packages into a file , Test by setting the white list .
(6)-monitor-native-crashes
Parameter description : Local code used to specify whether to monitor and report application crash . If the application itself has a local code base , You can take this parameter .
Example :adb shell monkey-pcom.android.calendar-monitor-native-crashes 1000
During the test , If calendar The application itself comes with a local code base ,monkey The local code... Will be reported in the display information .
边栏推荐
- R1 Quick Open Pressure Vessel Operation Special Operation Certificate Examination Library and Answers in 2022
- 可扩展系统的“9不”原则和“5个”衡量维度
- "Five layer" architecture of cloud applications and services
- Resource management, high availability and automation (medium)
- How does the open-ended Hall current sensor help the transformation of DC power distribution?
- 十年职场软件工程师感悟
- Resource management, high availability and automation (Part 2)
- Use js programming questions [split] in Niuke
- 新手开哪家的证券账户是比较好?炒股开户安全吗
- WebSocket(简单体验版)
猜你喜欢
【PaddleDetection】ModuleNotFoundError: No module named ‘paddle‘
2022年R1快开门式压力容器操作特种作业证考试题库及答案
在excel文件上设置下拉选项
How does the open-ended Hall current sensor help the transformation of DC power distribution?
自用工具 猴子都会用的unity视频播放器
Dataloader参数collate_fn的使用
A pit filling trip based on LNMP to build a personal website
云应用、服务的“5层”架构
Brief history and future trend of codeless software
Hot! Yolov6's fast and accurate target detection framework is open source (with source code download)
随机推荐
根据Explain查看sql执行计划,对SQL进行优化
Extensible database (I)
电子地图坐标系统研究整理
栈的基本操作(C语言实现)
Object类,以及__new__,__init__,__setattr__,__dict__
2022电工(初级)复训题库及在线模拟考试
音视频技术开发周刊 | 251
Arm development studio build compilation error
Resource management, high availability and automation (medium)
nn.Parameter和torch.nn.init系列函数给模型参数初始化
Tardigrade:Trino 解决 ETL 场景的方案
Build your own website (17)
建立自己的网站(17)
What is the difference between slice and array in go question bank 12?
WPF 下的自定义控件以及 Grid 中控件的自适应
2022年R1快开门式压力容器操作特种作业证考试题库及答案
Severe Tire Damage:世界上第一个在互联网上直播的摇滚乐队
Dataloader parameter collate_ Use of FN
导入Excel文件,解决跳过空白单元格不读取,并且下标前移的问题,以及RETURN_BLANK_AS_NULL报红
STM32外设SDIO和SD卡的配置