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框架的更多相关文章

  1. UiAutomator2.0升级填坑记

    UiAutomator2.0升级填坑记 SkySeraph May. 28th 2017 Email:skyseraph00@163.com 更多精彩请直接访问SkySeraph个人站点:www.sk ...

  2. UiAutomator1.0 与 UiAutomator2.0

      在使用2.0之前,对android自动化框架也做过一些了解<Android 自动化测试框架>.使用UiAutomator2.0也有一段时间,这里将1.0与2.0进行一个对比总结. Ui ...

  3. Uiautomator1.0与Uiautomator2.0测试项目搭建与运行原理

    Uiautomator是Android原生测试框架,可以用于白盒接口测试也可以用于UI自动化测试,Uiautomator分1.0版本与2.0版本,它们都是基于UiAutomation的测试框架,都是通 ...

  4. IdentityServer4 ASP.NET Core的OpenID Connect OAuth 2.0框架学习保护API

    IdentityServer4 ASP.NET Core的OpenID Connect OAuth 2.0框架学习之保护API. 使用IdentityServer4 来实现使用客户端凭据保护ASP.N ...

  5. win8 系统无法正常安装.net framework 2.0和3.0框架如何解决

    在安装.net framework2.0框架的时候一直提示要用户从网上面下载框架,你点击下载好的安装包也是无法安装的.这个时候就需要你使用离线的安装包来进行问题的解答附件在此http://pan.ba ...

  6. yii2.0框架安装心得

    yii2.0安装心得 能够搜索到这篇文章的朋友相信是对yii框架有兴趣的,但是我不得不吐槽的是,这个安装过程确实让人头疼,接下来就让大家见证一下这个纠结的过程 根据官网的说法,安装这个框架需要用到co ...

  7. php--yii2.0框架的curl

    yii2.0框架的增删改查 //插入操作  save() $customer=new Customer(); $customer->name=‘小熊‘; $customer->save() ...

  8. node.js 在 Express4.0 框架使用 Connect-Busboy 实现文件上传

    node.js下四种post提交数据的方式 今天说分享的是其中一种,就是上传文件. Express 4.0 以后,将功能原子化,高内聚,低耦合,独立出了很多中间件 今天主要分享文件上传 对于conne ...

  9. robotlegs2.0框架实例源码带注释

    robotlegs2.0框架实例源码带注释 Robotlegs2的Starling扩展 有个老外写了robotleges2的starling扩展,地址是 https://github.com/brea ...

随机推荐

  1. HDU 1253:胜利大逃亡(简单三维BFS)

    pid=1253">胜利大逃亡 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/ ...

  2. 网站的根目录下有一个文件robots.txt ,它是啥?

    我相信很多人有过这个疑问,这个robots文件是干嘛的? 我想问,各位搜索淘宝时,是否发现(禁止爬虫抓取提供快页) 关于详细语法,请看:http://zhidao.baidu.com/question ...

  3. windowsclient开发--使你的client执行时记住上次关闭的大小和位置

    差点儿全部的windowsclient都能够调整大小,所以用户依据自己的喜好调整client的大小和位置. 可是当该client退出后,又一次执行client的时候.我们往往又要调整自己喜好的大小和位 ...

  4. python(18)- 协程函数及应用

    协程 def init(func): def wrapper(*args,**kwargs): obj = func(*args,**kwargs) next(obj) return obj retu ...

  5. Linux Setuid(SUID)和Setgid(SGID) sticky bit

    http://www.php100.com/html/webkaifa/Linux/2010/0812/6392.html 1.setuid和setgid的解说 setuid和setgid位是让普通用 ...

  6. SpringSecurity学习笔记(一):搭建最简单的SpringSecurity应用

    学习过程参考自:http://www.mossle.com/docs/auth/html/pt01-quickstart.html 一.搭建Maven项目: 所需引用的jar包如下: pom.xml文 ...

  7. linux 块设备驱动(五)——块设备应用层的操作

    一: 加载好sbull驱动 root@CarRadio:/# ls /dev/sbull -l brw-r--r-- 1 root root 254, 16 Mar 25 08:25 /dev/sbu ...

  8. 不为客户连接创建子进程的并发回射服务器( poll实现 )

    前言 在上文中,我使用select函数实现了不为客户连接创建子进程的并发回射服务器( 点此进入 ).但其中有个细节确实有点麻烦,那就是还得设置一个client数组用来标记select监听描述符集中被设 ...

  9. 【windows phone】CollectionViewSource的妙用

    在windows phone中绑定集合数据的时候,有时候需要分层数据,通常需要以主从试图形式显示.通常的方法是将第二个ListBox(主视图)的数据源绑定到第一个ListBox (从视图)的Selec ...

  10. iOS开发之加载、滑动翻阅大量图片优化解决方案

    本文转载至 http://mobile.51cto.com/iphone-413267.htm 今天分享一下私人相册中,读取加载.滑动翻阅大量图片解决方案,我想强调的是,编程思想无关乎平台限制.我要详 ...