当前位置:网站首页>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
边栏推荐
- 数据分析-启动子进化分析
- 简历模板百度网盘自取
- 决策树预测红酒品质
- Google Earth Engine(GEE)——联合国粮农组织全球有机土壤面积(1992-2018年度)
- Tencent tangdaosheng: facing the new world of digital and real integration, developers are the most important "architects"
- 恒生电子:金融分布式数据库LightDB通过中国信通院多项测评
- 抢做意大利岛主?刘强东两月套现66亿 疑一次性5.6亿“紧急转账”急购欧洲海上皇宫
- Elastic box auto wrap demo
- 设计人工智能产品:技术可能性、用户合意性、商业可行性
- 《天天数学》连载53:二月二十二日
猜你喜欢
Unit test ci/cd
Forecast and Analysis on market scale and development trend of China's operation and maintenance security products in 2022
Google Earth engine (GEE) - Global organic soil area of FAO (1992-2018)
MySQL多表联合查询
Centos6.5 php+mysql MySQL library not found
5A synchronous rectifier chip 20V to 12v2a/5v4.5a high current 24W high power synchronous rectifier chip high current step-down IC fs2462
From PDB source code to frame frame object
APP冷热启动专项测试
The counter attack story of Fu Jie, a young secondary school student: I spent 20 years from the second undergraduate to the ICLR outstanding Thesis Award
Buuctf:[wustctf2020] plain
随机推荐
Shareit a une force exceptionnelle et se connecte au top 7 de la liste mondiale des forces IAP
Arduino-ESP32闪存文件插件程序搭建和上传
How to solve the data inconsistency between redis and MySQL?
Centos7: switch MySQL users and log in to MySQL
Buuctf:[wustctf2020] plain
一文抄 10 篇!韩国发表的顶级会议论文被曝抄袭,第一作者是“原罪”?
华泰证券开户怎么开 怎么办理开户最安全
Mobile web training day-2
Commonly used "redmine" for # test bug
为什么越来越多的用户放弃 Swagger,选择Apifox
List集合转数组
RK3399平台开发系列讲解(使用篇)Pinctrl子系统的介绍 - 视频介绍
公司领导说,个人代码超10个Bug就开除,是什么体验?
《天天数学》连载53:二月二十二日
全志V853芯片 如何在Tina V85x平台切换sensor?
Matlab plotyy coordinate axis setting, [reprint] example of MATLAB plotyy drawing double ordinate graph [easy to understand]
Vscode如何设置代码保存后自动格式化
词云的可视化设计教程
海思35xx实现GT911触摸屏功能「建议收藏」
开源项目维权成功案例: Spug 开源运维平台成功维权