美文网首页Android开发Android知识
Mac下配置Battery Historian 2.0测试环境

Mac下配置Battery Historian 2.0测试环境

作者: 追云_似梦 | 来源:发表于2016-03-10 15:08 被阅读1588次

操作系统环境

Mac OSX

前言

Battery historian是一款通过上传bugreport文件分析用户手机中App的电池耗电情况的工具,由Google开发,其中包括四个模块,分别为系统状态、历史数据、遗留历史数据以及App状态(图中以微信为例)。

System Status.png
Historian2.0.png
Historian(legacy).png
App Status.png

注意: Battery historizan 支持的分析类型为 Android 5.0及以上设备。如果在Android 5.0 一下的设备只会显示一个legacy的分布图。

以红米Note 1S导出的bugreport为例,看看运行截图如下:

HM Note 1S.png

Battery historian 是基于Go语言搭建的本地分析测试服务。当然作为公司,可以部署在公有的测试服务器上,方便测试人员测试分析。

配置Go语言环境

  1. 首先下载Go的安装文件pkg,下载地址如下:

https://golang.org/doc/install#testing

  1. 其次配置Go环境:

注意:实际测试go 1.5.1版本的在运行解析时会报错。本文采用的go 1.6版本,没有任何问题。

命令如下:

go get -u github.com/golang/protobuf/proto

go get -u github.com/golang/protobuf/protoc-gen-go

go get -u github.com/google/battery-histrizan

cd $GOPATH/src/github.com/google/battery-historian/

bash setup.sh

go run cmd/battery-historian/battery-historian.go

通过以上几个步骤,即可运行。在浏览器中访问,默认接口为9999

http://localhost:9999

按照以上的步骤,就可以成功运行 battery-historian 。

运行截图:

Paste_Image.png

导出设备bugreport信息:

adb bugreport > bugreport.txt 

会在运行之后,将文件导出到所执行命令的当前目录下,文件为bugreport.txt。

选择文件--> 提交 即可获取到分析的结果,如图:

System Status.png

注意事项

  • 检查Go语言版本,Go 1.6版本。
  • 检查Android系统版本,需要5.0及以上设备支持。

通过以上步骤即可搭建Android电池电量测试服务。

相关文章

网友评论

  • 张燕茹:➜ ~ go get -u github.com/google/battery-histrizan
    # cd .; git clone https://github.com/google/battery-histrizan /Users/zhangyanru/go/src/github.com/google/battery-histrizan
    Cloning into '/Users/zhangyanru/go/src/github.com/google/battery-histrizan'...
    remote: Repository not found.
    fatal: repository 'https://github.com/google/battery-histrizan/' not found
    package github.com/google/battery-histrizan: exit status 128
    追云_似梦:@张燕茹这篇文章是去年写的,建议按照官方文档配置会比较好。加油↖(^ω^)↗
    张燕茹:go run setup.go 一直卡在 : Downloading Closure library.
    张燕茹:应该为:go get -u github.com/google/battery-historian
  • enumerate:楼主,我下的版本里,没有setup.sh文件,只有setup.go这是怎么回事,我现在运行的应该还是第一版,第二版,名称后面会有个2,而且界面也不一样,不知道怎么才能获取那个sh的安装文件
    enumerate:@cdf0e739349f 多谢
    f307cf44e92a:go run setup.go
    enumerate:@cdf0e739349f 我是linux系统

本文标题:Mac下配置Battery Historian 2.0测试环境

本文链接:https://www.haomeiwen.com/subject/bpytlttx.html