uiautomator2.0框架
1.
|
Uiautomator1.0 |
Uiautomator2.0 |
|
|
date |
2012 |
2015 |
|
super class |
UiAutomatorTestCase |
InstrumentationTestCase |
|
language |
java |
java |
|
executable file |
jar |
APK |
|
API-level |
16(4.1)+ |
18(4.3)+ |
|
permission |
- |
less |
|
context |
no |
yes |
|
extends |
Junit3 需要继承UiAutomatorTestCase |
Junit4 测试类不需要继承父类 |
2.
Linux 下Set up UI Automator2.0
打开android studio,新建工程 File—》new—》new project,选择最小的sdk为19,选择【Blank Activity】,下一步-完成;
3.
修改build.gradle(Module:app)文件
android{}中增加
packagingOptions {
exclude 'LICENSE.txt'
}
defaultConfig {
multiDexEnabled true
}
dependencies{}中增加
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.0.0' /v18:2.1.1
4.
app-java-..[AndroidTest]中创建类,编写脚本,点击un 运行脚本


5.
脱机运行:
uiautomator1.0
.adb push E:\eclipse2\workspace\test-miui\bin\uitestpowerconsume.jar /data/local/tmp
adb shell uiautomator runtest uitestpowerconsume.jar --nohup -c com.miui.sec.Test_PowerConsume#testPowerConsume
Uiautomator2.0:
方法1.
使用这个nohup 这个参数时,会报错是: nohup: /nohup.out: Read-only file system
所以我使用重新写了个路径 eg: /data/nohup.out
但是是先进到shell中 再执行
nohup am instrument -w -r -e debug false -e class com.demo.mi.myapplication.Demo com.demo.mi.myapplication.test/android.support.test.runner.AndroidJUnitRunner > /data/nohup.out
方法2.
在末尾加上& 也可以实现
先进到shell中 再执行
nohup am instrument -w -r -e debug false -e class com.demo.mi.myapplication.Demo com.demo.mi.myapplication.test/android.support.test.runner.AndroidJUnitRunner&
UIAUTOMATOR 2.0的教程http://blog.csdn.net/java18/article/details/53535928
uiautomator2.0框架的更多相关文章
- UiAutomator2.0升级填坑记
UiAutomator2.0升级填坑记 SkySeraph May. 28th 2017 Email:skyseraph00@163.com 更多精彩请直接访问SkySeraph个人站点:www.sk ...
- UiAutomator1.0 与 UiAutomator2.0
在使用2.0之前,对android自动化框架也做过一些了解<Android 自动化测试框架>.使用UiAutomator2.0也有一段时间,这里将1.0与2.0进行一个对比总结. Ui ...
- Uiautomator1.0与Uiautomator2.0测试项目搭建与运行原理
Uiautomator是Android原生测试框架,可以用于白盒接口测试也可以用于UI自动化测试,Uiautomator分1.0版本与2.0版本,它们都是基于UiAutomation的测试框架,都是通 ...
- IdentityServer4 ASP.NET Core的OpenID Connect OAuth 2.0框架学习保护API
IdentityServer4 ASP.NET Core的OpenID Connect OAuth 2.0框架学习之保护API. 使用IdentityServer4 来实现使用客户端凭据保护ASP.N ...
- win8 系统无法正常安装.net framework 2.0和3.0框架如何解决
在安装.net framework2.0框架的时候一直提示要用户从网上面下载框架,你点击下载好的安装包也是无法安装的.这个时候就需要你使用离线的安装包来进行问题的解答附件在此http://pan.ba ...
- yii2.0框架安装心得
yii2.0安装心得 能够搜索到这篇文章的朋友相信是对yii框架有兴趣的,但是我不得不吐槽的是,这个安装过程确实让人头疼,接下来就让大家见证一下这个纠结的过程 根据官网的说法,安装这个框架需要用到co ...
- php--yii2.0框架的curl
yii2.0框架的增删改查 //插入操作 save() $customer=new Customer(); $customer->name=‘小熊‘; $customer->save() ...
- node.js 在 Express4.0 框架使用 Connect-Busboy 实现文件上传
node.js下四种post提交数据的方式 今天说分享的是其中一种,就是上传文件. Express 4.0 以后,将功能原子化,高内聚,低耦合,独立出了很多中间件 今天主要分享文件上传 对于conne ...
- robotlegs2.0框架实例源码带注释
robotlegs2.0框架实例源码带注释 Robotlegs2的Starling扩展 有个老外写了robotleges2的starling扩展,地址是 https://github.com/brea ...
随机推荐
- angular - 介绍
导入全局样式,生产环境和浏览器环境都导入了. 不知否你还记得index.html那个里面的节点 熟悉吗? 很熟悉吧
- 【Java编程】Java在dos窗体编译与运行的批处理
近期在Java编程过程中,常常使用到dos窗体对程序进行编译与执行. 可是不方便之处在于每次都要输入命令进入将要编译的程序的文件夹(事实上也有简单的方法,在文章末尾给出).于是编写了一个配置文件,能够 ...
- 转:scanf的用法
https://blog.csdn.net/u012421456/article/details/18501309 scanf()[通过键盘将数据输入到变量中] 它有两种用法: 用法一: scanf( ...
- vim 自动补全
1. vim编辑器自带关键字补全 触发: ctrl + n or ctrl + p 补全命令: <C-n> 普通关键字 [能够根据buffer以及标签文件列表等 ...
- LeetCode:判断最长前缀
之前一直忽略了一个问题就是:给定的空字符串数组 char* longestCommonPrefix(char** strs, int strsSize) { char* result; if(strs ...
- java: private, protected, public
这三个 「可访问修饰符」,是一个老生常谈的话题了.在 C++ 中也有类似的概念. 按其修饰对象的不同,分为几种用法小记一下: 用于类 只有 public 可以修饰类:private 和 protect ...
- openh264 在 osx 上的 nasm 问题
先在 pc 上编译,熟悉一下. 编译遇到一个问题: nasm -DUNIX64 -DPREFIX -f macho64 -I./codec/common/x86/ -o codec/common/x8 ...
- python 修饰符(转载)
首先一个修饰符的实例: #!/usr/bin/env python def run(fn): def do_hello(): print "begin..." fn() print ...
- 海康DS NVR播放URL规则
URL规定:rtsp://username:password@<address>:<port>/Streaming/Channels/<id>(?parm1=val ...
- BitMapFactory.decodeFile 总是返回NULL的原因之一
之前碰到过,顺便记录下来,如果出现这种情况,首先看看是否有对这个文件的读权限.