当前位置:网站首页>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

边栏推荐
- Hubble database x a joint-stock commercial bank: upgrade the number management system of Guanzi, so that every RMB has an "ID card"
- 1015.摘花生
- PHP gets the number of digits and replaces it with the specified mantissa
- 为什么越来越多的用户放弃 Swagger,选择Apifox
- Google Earth engine (GEE) - Global organic soil area of FAO (1992-2018)
- 恒生电子:金融分布式数据库LightDB通过中国信通院多项测评
- 我呕血收集融合了来自各路经典shell书籍的脚本教学,作为小白的你快点来吧
- The difference between align items and align content
- FH511+TP4333组成一个户外移动电源照明野营灯方案。
- Oracle cloud infrastructure extends distributed cloud services to provide organizations with greater flexibility and controllability
猜你喜欢

Visual design tutorial of word cloud

弹性盒子自动换行小Demo

How to set auto format after saving code in vscade

抢做意大利岛主?刘强东两月套现66亿 疑一次性5.6亿“紧急转账”急购欧洲海上皇宫

Mobile web training -flex layout test question 1

腾讯汤道生:面向数实融合新世界,开发者是最重要的“建筑师”

From PDB source code to frame frame object

Why do more and more users give up swagger and choose apifox

移动Web实训DAY-2

PHP抓取网页获取特定信息
随机推荐
行动诠释价值,城联优品韩董事长出席广东英德抗洪捐赠公益活动会
嵌入式开发:估算电池寿命的7个技巧
Centos6.5 php+mysql MySQL library not found
MySQL multi table joint query
2.01 backpack problem
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
Electronic components distribution 1billion Club [easy to understand]
In the past four years, the number of users exceeded 100 million, and sun Ge led the wave field to a new high
Latest summary! 30 provinces announce 2022 college entrance examination scores
Align content attribute in flex layout
Successful cases of rights protection of open source projects: successful rights protection of SPuG open source operation and maintenance platform
Stm32f1 and stm32cubeide programming example - matrix keyboard driver
无心剑英译朱熹《观书有感二首·其一》
电脑无线网络不显示网络列表应该如何解决
Fh511+tp4333 form an outdoor mobile power lighting camping lamp scheme.
5A synchronous rectifier chip 20V to 12v2a/5v4.5a high current 24W high power synchronous rectifier chip high current step-down IC fs2462
再谈exception——异常抛出时会发生什么?
完全背包 初学篇「建议收藏」
求职简历的书写技巧
电驴怎么显示服务器列表,(转)如何更新电驴服务器列表(eMule Server List)