Android Instrument测试命令使用小记
来源:互联网 发布:北京 人工智能 编辑:程序博客网 时间:2024/05/12 07:17
1. Instrunent介绍
instrument为am命令的一个子命令。用于启动一个Instrumentation测试。首先连接手机或者模拟器,通过adb shell命令,进入shell层进行操作。
2. Instrument命令及参数
2.1 命令格式:
am instrument [-r][-e <NAME><VALUE>][-p <FILE>] [-w] [--user<USER_ID>|current] [--no-window-animation] [--abi <ABI>] <COMPONENT>
2.2 参数介绍:
-r : 打印原始结果(否则解码REPORT_KEY_STREAMRESULT)。使用[-e perf true]生成性能度量的原始输出。
-e <NAME><VALUE>: 设置参数<NAME> <VALUE>。对于测试运行器常见的格式为:[-e <testrunner_flag> <value>[,<value>...]]
-p <FILE>: 将profiling性能数据写入到文件中。
-w: 等待测试完成。这是一个必选参数。
--user <USER_ID>|current: 指定用户运行,如果不指定则使用当前用户运行。
--no-window-animation: 关掉运行时的窗口动画,e.g. 手机窗口滑动动画。
3 示例:
3.1 测试工程:
3.2 通过pm list instrumentation列出手机中安装的instrumentation:
3.3 运行指定测试类,并输出详细结果,同时将profiling性能数据写到本地文件中:
am instrument -w -r -p /data/local/tmp/demo.trace -e class com.test.tommyxie.hellouiautomator.UiautomatorBaseTestCase com.test.tommyxie.hellouiautomator.test/android.support.test.runner.AndroidJUnitRunner
3.4 将trace文件拉取到本地,通过traceview工具打开:
- Android Instrument测试命令使用小记
- 使用Android Instrument 自动测试 WIFI_SERVICE
- 【转】使用Android Instrument 自动测试 WIFI_SERVICE
- 使用Android Instrument 自动测试 WIFI_SERVICE
- Android Wifi:使用Android Instrument 自动测试 WIFI_SERVICE
- Android Instrument自动测试:Wifi_service
- Android Instrument 自动测试 WIFI on off
- Android 经验: 不能用 instrument 替代的 CTS 测试
- 调试教程 – 使用UIRecorder Instrument将测试自动化
- Android monkey测试小记
- Android测试小记
- 测试覆盖率 使用小记
- shell命令使用小记
- Android Studio中使用 instrument junit4 环境配置问题
- Instrument的使用
- Instrument使用总结
- LoadRunner 负载测试使用小记
- android Intent 使用 小记
- 1002. 写出这个数 (20)——做题纪录
- linux wait函数
- 使用spark mllib识别LED数字
- Linux内核分析第三周
- UVa227
- Android Instrument测试命令使用小记
- IOS开发之OC学习笔记(上)
- 06.数据库日常应用实例
- Java网络编程案例--CS模型的简单实现
- 如何解读Caffe源码
- Timer类的缺陷
- enterpriseLibrary连接MySQL数据库
- 造轮子:补码分析补充(二)
- 设计模式之---创建型模式(二)--抽象工厂模式 (Abstract Factory)