使用AndroidStudio执行UI Automator 自动化测试版本问题
2017-03-20 19:49
246 查看
摘要
最近在研究UiAutomator自动化测试问题,写好之后却报了下面这样一个问题:网上看到UIAutomator 2.0版本,并且貌似使用的框架都改变了,所以今天就抽空试了下We’re pleased to announce the release of UIAutomator 2.0! This version is a significant update from the previous release. Most importantly, UI Automator is now based on Android Instrumentation and you can build and run tests withthe ‘./gradlew connectedCheck’ command.大体的意思就是UIAutomator2.0基于的框架改成了android的instrumentatioin的框架。并且可以通过gradle进行配置了,虽然说实话不太清楚为什么要将UiAutomator的框架改成instrumentation,但是我们先试试大概答题的环境出来吧。
下来我们就来试试通过Android Studio 来进行UiAutomator的配置吧
UiAutomator2.0的jar包并不是在以前SDK/platforms/android-19/下。现在我们要这么做通过Android SDK Manager中的 Android Support Repository 项进行安装下载下来的jar包的路径为/extras/android/m2repository
新建一个android项目,编写一个简单的应用在build.gradle中配置依赖项:
dependencies { androidTestCompile 'com.android.support.test:runner:0.3' // Set this dependency to use JUnit 4 rules androidTestCompile 'com.android.support.test:rules:0.3' // Set this dependency to build and run Espresso tests androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2' // Set this dependency to build and run UI Automator tests androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1' }
设置AndroidJunitRunner为默认的testInstrumentationRunner
android { defaultConfig { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }
}
以上版本问题是解决了,但是jar包的问题还被困扰,有路过的大神望指导一下。
相关文章推荐
- Android Webview的使用中,onPageFinished方法和onReceivedError方法,onPageFinished在4.4版本会被多次执行的问题
- AndroidStudio中使用老版本Gradle出现的问题
- 微信6.2.2版本使用文本上传框出现没有应用可执行此操作的问题
- 使用AndroidStudio执行UI Automator 自动化测试
- 集合已修改;枚举操作可能无法执行。使用foreach 循环删除DataRow的时候的问题! 该死的AcceptChanges() Row.elete() Remove(Row)使用不同。
- 使用dojo declare(继承v102版本) 时出现无法根据id获取到对象的问题
- 关于用c生成的dll在使用其他供应商的工具创建可执行模块时遇到的一些问题
- spring.net 1.1.0 P3版本 中spring.core.dll 1.1.0.2版本对于AOP使用ADVICE中涉及使用ref/out参数的小问题
- 使用ODBC和OLEDB两种方式执行同一个存储过程,结果不同的问题!
- 关于:“无法序列化会话状态。在“StateServer”或“SQLServer”模式下,ASP.NET 将序列化会话状态对象,因此不允许使用无法序列化的对象或 MarshalByRef 对象。如果自定义会话状态存储在“Custom”模式下执行了类似的序列化,则适用同样的限制。”的问题
- 使用 JDBC 连接不同版本 DB2 数据库的兼容性问题
- 使用 JDBC 连接不同版本 DB2 数据库的兼容性问题
- 使用FCKeditor_2.6.3版本有关上传图片问题解决
- 执行SQL语句时出现问题操作必须使用一个可更新的查询错误的解决方法
- Eclipse结合SVN进行版本控制在执行更新时遇到的问题
- 在安装有VS2008beta2版本的机子上使用vs2005进行部署出现问题的解决方法
- "执行SQL语句时出现问题操作必须使用一个可更新的查询"错误的解决方法
- 在64位Windows中使用64位版本ASP.NET 2.0的问题
- 修正BlogEngine.Net中的使用全中文为标题的链接问题(在1.1以上版本此问题已被修复)
- 使用Jmeter对Mysql进行压力测试无法执行多条sql语句问题