当前位置:网站首页>Special test for cold and hot start of app
Special test for cold and hot start of app
2022-06-28 13:27:00 【Software testing Xiaobai】
One 、 Cold and hot start concept
Cold start : When starting the app , There is no process for this application in the background , At this time, the system will re create a new process to assign to the application , The starting mode is cold starting .
Hot start : When starting the app , The application process already exists in the background ( example : Press back key 、home key , The app will exit , However, the process of the application will still remain in the background , You can enter the task list to view ), So in the case of existing processes , This startup will start the application from the existing process , This startup mode is called hot startup .
Two 、 The core principle
APP Start up time , Can pass adb shell am start -W Ordered TotalTime obtain .
adb shell am start -W -n Package name /Activity name

ThisTime The activity Time to start
TotalTime It takes time to start the application itself =ThisTime+ application application And so on
WaitTime It takes time for the system to start the application =TotalTime+ System resource start time
3、 ... and 、 scripting
import time
import os
def StartApp():
cmd="adb shell am start -W -n com.weitian.oa/.IndexActivity"
result=os.popen(cmd)
return result
def StopApp(mode):
if mode == 'hot':
cmd = "adb shell input keyevent 3"
result=os.popen(cmd)
if mode=='cold':
cmd="adb shell am force-stop com.weitian.oa"
os.popen(cmd)
def GetStartTime(result,count):
for one in result.read().splitlines():
if'TotalTime' in one:
one=one.split(":")[1]
one=one.strip()
one=int(one)
print(f" The first {count} Second startup {one} millisecond ")
return one
if __name__ == "__main__":
mod=input(" Hot and cold start test , Please enter the mode :hot Hot start test ,cold Cold start test ")
count=int(input(" Please enter the number of tests "))
if mod=='hot':
input(" Hot start test , Please make sure app Has been opened and retired to the background \n Press enter to continue ...")
if mod=='cold':
input(" Cold start test , Please make sure app Not open \n Press enter to continue ...")
time_list = []
for i in range(count):
result=StartApp()
time_list.append(GetStartTime(result, i + 1))
time.sleep(3)
StopApp(mod)
time.sleep(3)
else:
print(f" Average startup time {sum(time_list)/count} millisecond ")

welfare

边栏推荐
- PHP抓取网页获取特定信息
- 5A synchronous rectifier chip 20V to 12v2a/5v4.5a high current 24W high power synchronous rectifier chip high current step-down IC fs2462
- 弹性盒子自动换行小Demo
- List set to array
- 数据分析-启动子进化分析
- How to set auto format after saving code in vscade
- PHP obtains the beginning and end time of the month according to the month and year
- FH511+TP4333组成一个户外移动电源照明野营灯方案。
- plt. Usage of savefig() and save path
- 单元测试 CI/CD
猜你喜欢

Visual design tutorial of word cloud

公司领导说,个人代码超10个Bug就开除,是什么体验?

New product experience: Alibaba cloud's new generation of local SSD instance I4 open beta

Oracle 云基础设施扩展分布式云服务,为组织提供更高的灵活性和可控性

Pytorch Foundation

PHP crawls web pages for specific information

5A同步整流芯片 20V转12V2A/5V4.5A大电流 24W大功率同步整流芯片 大电流降压IC FS2462

新品体验:阿里云新一代本地SSD实例i4开放公测

yii2编写swoole的websocket服务

How to solve the problem that the computer wireless network does not display the network list
随机推荐
From PDB source code to frame frame object
新品体验:阿里云新一代本地SSD实例i4开放公测
初识exception
公司领导说,个人代码超10个Bug就开除,是什么体验?
中国数据库技术大会(DTCC)特邀科蓝SUNDB数据库专家精彩分享
同花顺上怎么进行开户啊, 安全吗
yii2连接websocket服务实现服务端主动推送消息给客户端
PHP crawls web pages for specific information
MySQL multi table joint query
PostgreSQL超越MySQL
PHP gets the number of digits and replaces it with the specified mantissa
How to display the server list of the electric donkey, and how to update the eMule server list
pytorch基础
哈希竞猜游戏系统开发技术成熟案例及源码
matlab plotyy 坐标轴设置,[转载]Matlab plotyy画双纵坐标图实例[通俗易懂]
The English translation of heartless sword Zhu Xi's two impressions of reading
恒生电子:金融分布式数据库LightDB通过中国信通院多项测评
Tiantian mathematics serial 53: February 22
How to solve the data inconsistency between redis and MySQL?
Stm32f1 and stm32cubeide programming example - matrix keyboard driver