嗯 类似
之前做过类似的,并且已经平台化 https://testerhome.com/topics/28243
调整了一下楼主的方案,使之能够在 windows10 下运行
import subprocess
import time
# 执行shell
def shell(cmd):
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
dt = p.stdout.read()
return dt
# 启动app应用
def app_start(package_name, launch_activity, device_id = ''):
if device_id != '':
cmd_start = "adb -s %s shell am start -n %s" % (device_id, package_name + "/" + launch_activity)
else:
cmd_start = "adb shell am start -n %s" % (package_name + "/" + launch_activity)
shell(cmd_start)
time.sleep(3)
# print("App start success: " + str(cmd_start))
# 退出app应用
def app_stop(package_name, device_id = ''):
if device_id != '':
cmd_stop = "adb -s %s shell am force-stop %s" % (device_id, package_name)
else:
cmd_stop = "adb shell am force-stop %s" % (package_name)
shell(cmd_stop)
time.sleep(1)
# print("App stop finishes: " + str(cmd_stop))
# 判断app应用是否在前台
def is_activity_started(package_name, device_id = ''):
if device_id != '':
cmd_current_activity = "adb -s %s shell dumpsys activity activities | sed -En -e '/Running activities/,/Run #0/p'" % device_id
else:
cmd_current_activity = "adb shell dumpsys activity activities | sed -En -e '/Running activities/,/Run #0/p'"
cmd_result = str(shell(cmd_current_activity))
# 如果当前应用处于前台或resume后台状态,返回True
if package_name in cmd_result:
return True
else:
return False
# 设置app应用后台运行
def set_activity_backup(package_name, launch_activity, device_id = ''):
if device_id != '':
if not is_activity_started(package_name, device_id):
app_start(package_name, launch_activity, device_id)
cmd = 'adb -s %s shell input keyevent key 3' % device_id
else:
if not is_activity_started(package_name):
app_start(package_name, launch_activity)
cmd = 'adb shell input keyevent key 3'
shell(cmd)
# 获取冷启动时间
def get_cold_boot_time(package_name, launch_activity, device_id = ''):
if is_activity_started(package_name, device_id):
app_stop(package_name, device_id)
if device_id != '':
cmd_start = "adb -s %s shell am start -W %s | grep 'WaitTime'" % (device_id, package_name + "/" + launch_activity)
else:
cmd_start = "adb shell am start -W %s | grep 'WaitTime'" % (package_name + "/" + launch_activity)
cold_boot_time = shell(cmd_start)[10:].strip()
return int(cold_boot_time)
# 获取热启动时间
def get_hot_boot_time(package_name, launch_activity, device_id = ''):
set_activity_backup(package_name, launch_activity, device_id)
if device_id != '':
cmd_start = "adb -s %s shell am start -W %s | grep 'WaitTime'" % (device_id, package_name + "/" + launch_activity)
else:
cmd_start = "adb shell am start -W %s | grep 'WaitTime'" % (package_name + "/" + launch_activity)
cold_boot_time = shell(cmd_start)[10:].strip()
return int(cold_boot_time)
# 执行测试,times为次数,结果取平均值
def run_test(times):
cold_time = []
hot_time = []
for i in range(times):
cold_time.append(get_cold_boot_time('com.tencent.mobileqq', '.activity.SplashActivity'))
hot_time.append(get_hot_boot_time('com.tencent.mobileqq', '.activity.SplashActivity', 'abbed25'))
res_cold_time = 0
res_hot_time = 0
print("cold_time = " + str(cold_time))
print("hot_time = " + str(hot_time))
for i in cold_time:
res_cold_time = res_cold_time + i
print('average cold_time: ' + str(res_cold_time / times) + ' ms')
for i in hot_time:
res_hot_time = res_hot_time + i
print('average hot_time: ' + str(res_hot_time/times) + ' ms')
# 执行10次
#print(shell('adb devices'))
print(get_cold_boot_time('com.itic.maas.app', '.module.home.activity.WelcomeActivity'))
admini0 吧,或者你去看下登录逻辑是用的 md5+ 盐
注册的账号由于未分配角色导致没有权限。你可以使用 youke/admini0 进行测试
有你想要的自动生成测试用例
我刚才试了是通的呀
好像是第一次上传出错(上传的 icon 格式),后面在调整为正确格式(png)也报错。重新打开页面上传正确格式就好了。chrome 版本 108.0.5359.125
前端:
1.npm install
2.npm run dev
后端:
1.mvn clean install
2.java -jar jarName.jar
已经上传了封面图片
好像弄不了
@chenhengjie123 版主老大,这个能收录到开源项目嘛
对的
后端是用 idea 开发的
正交算法用的 python 的一个库
非常感謝!
哈哈 说笑了 代码写的烂 可以提供思路
可以看到 jtl 中的 90%Line 和报告中的 90th pct 相差结果太大了,该报告基于 jtl 解析而来
好的,谢谢!
有点像聚合报告,但又不完全是,或者说这是某个 jmeter 版本的嘛
keep alive 别勾选,不然一直占用端口,释放不了
你可以在接口测试中全部使用 mock server 来进行转发,当 mock server 发现接口地址真实存在就转发至真实的服务,否则就走自己 mock 的接口
分页一般不用校验,框架组件如 pagehelp。只要校验 total 就行