UI Automator环境搭建

原因

之前改了Launcher好多的地方,需要进行UI相关的测试。因为launcher本身很复杂,所以最好的方式是UI自动测试。选择使用UI Automator来做这个工作,毕竟是谷歌主推的,根红苗正。

工具

  1. Android Studio
  2. uiautomatorviewer (在sdk中)

studio配置

  1. Support Library Setup(build.gradle中)

dependencies {
androidTestCompile 'com.android.support.test:runner:0.4'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.4'
// Set this dependency to build and run Espresso tests
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
// Set this dependency to build and run UI Automator tests
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
}

android {
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}}

minSDKVersion为18以上

2 创建一个工程,在AndroidTest里面添加测试的类

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容