Cod*_*ice 5 testing android android-studio testing-support-library
我正在将所有测试转换为测试支持库。LargeTest
但是,当我尝试像这样导入注释时
import android.support.test.filters.LargeTest;
Run Code Online (Sandbox Code Playgroud)
我明白了Cannot resolve symbol 'LargeTest'
。我需要将什么依赖项添加到我的 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'
}
Run Code Online (Sandbox Code Playgroud)
并添加:
android {
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
Run Code Online (Sandbox Code Playgroud)