由于官方文档中有关Espresso 的介绍都是基于AndroidX的 所以这里把以support包集成Espresso 的方式记录一下
-
配置
testInstrumentationRunner
defaultConfig { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }
-
配置依赖项
//单元测试 testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2',{ exclude group: 'com.android.support' } androidTestImplementation 'com.android.support.test:rules:1.0.2',{ exclude group: 'com.android.support' } androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2',{ exclude group: 'com.android.support' }