专项测试-耗电量测试

耗电量测试

batterystats

adb shell dumpsys batterystats com.xueqiu.android

battery historian

git clone https://github.com/google/battery-historian.git
cd battery-historian
go get -d -u github.com/google/battery-historian/...
#需要更新下setup.go里面的closure library的版本为2018年后的版本
go run setup.go
go run cmd/battery-historian/battery-historian.go

准备工作

adb shell dumpsys batterystats --reset
adb shell dumpsys batterystats --enable full-wake-history

场景

start=$(date +%s); 
while true; do 
cur=$(date +%s); 
((cur-start>6)) && break; 
adb shell input swipe 100 800 100 300; 
sleep 1;
echo $((cur-start)); 
done

收集耗电量数据

#有时候数据不会主动更新,需要插拔下即可更新
#9.0系统
adb bugreport
#For devices running Android 7.0 and higher:
adb bugreport > [path/]bugreport.zip

#For devices running Android 6.0 and lower:
adb bugreport > [path/]bugreport.txt

一个真实情况的手机耗电数据

battery historian演练地址:http://47.95.238.18:9999/

弱网测试

模拟工具

场景

  • 使用遍历工具发现足够多的场景问题

测试的目标

  • 性能测试,测试特定网络情况的用户体验
  • 健壮性测试,测试特定场景下的业务流程是否可用