APP专项测试

发布时间 2023-07-15 20:25:05作者: 韩凯1990

启动10app

import subprocess,time
from pyecharts.charts import *

current_activity = "com.v2ay.ang/.ui.MainActivity"
cmd1 = "adb -s ANP4C20410007003 shell am start -S -W " + current_activity + " | findstr TotalTime"
print(cmd1)  # adb -s ANP4C20410007003 shell am start -S -W com.v2ay.ang/.ui.MainActivity | findstr TotalTime

start_list = []  # ['第1次', '第2次', '第3次', '第4次', '第5次', '第6次', '第7次', '第8次', '第9次', '第10次']
time_list = []  # [' 263', ' 329', ' 263', ' 256', ' 262', ' 263', ' 275', ' 266', ' 258', ' 268']
for i in range(1, 11):
    start_list.append('第{0}次'.format(i))
    console = subprocess.getstatusoutput(cmd1)
    total_time = list(console)[1].split(": ")[1]
    time_list.append(total_time)
    time.sleep(1)
print(time_list)
print(start_list)

line = (
    Line().add_xaxis(start_list).add_yaxis('', time_list)
      )
# line.render_notebook()
line.render()

绘成折线图