美文网首页
UI Automator环境搭建

UI Automator环境搭建

作者: wbxjack | 来源:发表于2016-05-19 11:13 被阅读440次

    原因

    之前改了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里面添加测试的类

    相关文章

      网友评论

          本文标题:UI Automator环境搭建

          本文链接:https://www.haomeiwen.com/subject/pieprttx.html