Android app专项测试之耗电量测试

一、前言
耗电量指标
待机时间成关注目标
提升用户体验
通过不同的测试场景,找出app高耗电的场景并解决

二、需要的环境准备
1、python2.7(必须是2.7,3.X版本是不支持的)
2、golang语言的开发环境
3、Android SDK
此三个的环境搭建这里就不详细说了,自行在网上找资料吧

三、battery-historian服务搭建
1、克隆安装包
git clone https://github.com/google/battery-historian.git
2、下载battery-historian的代码和依赖
go get -d -u github.com/google/battery-historian/...
3、修改setup.go文件的参数
closureCompilerVersion = "20170409"
值修改为
closureCompilerVersion = "20190513"
因为版本不一样,编译会失败,所以升级到稳定版本
4、切换到setup.go所在的目录,进行编译
go run setup.go


5、启动battery-historian服务
go run cmd/battery-historian/battery-historian.go


6、验证是否安装成功
http://localhost:9999/,出现如下,则ok

四、进行耗电量数据收集
1、清理耗电量数据
adb kill-server
adb start-server
adb shell dumpsys batterystats --reset
adb shell dumpsys batterystats --enable full-wake-history
2、运行测试用例/手工操作
使用monkey或appium来操作想要被测试的Android应用,最好就持续几个钟,效果才比较明显,这里具体就不展开详细说明了
3、收集数据
Android 7.0以上版本使用的命令 :adb bugreport bugreport.zip
Android 6.0 或以下使用的命令: adb bugreport > bugreport.txt

五、上传数据,进行数据分析

posted @   未来可期_Durant  阅读(560)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
点击右上角即可分享
微信分享提示