【发布时间】:2020-06-19 23:56:41
【问题描述】:
有一种方法可以定义应该运行哪些测试:
android {
defaultConfig {
testInstrumentationRunnerArgument("annotation", "com.hello.RunThisTestOnly")
}
}
另一种方法是使用命令行参数:
./gradlew connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.hello.RunThisTestOnly
但是当我尝试从另一个任务设置相同的参数并运行 connectedAndroidTest 时,该参数被忽略:
task taskX {
doFirst {
android.defaultConfig.testInstrumentationRunnerArgument 'annotation', 'com.hello.RunThisTestOnly'
}
finalizedBy 'connectedAndroidTest'
}
./gradlew taskX
为什么参数被忽略?
【问题讨论】: