【问题标题】:Setting testInstrumentationRunnerArgument from another task从另一个任务设置 testInstrumentationRunnerArgument
【发布时间】: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

为什么参数被忽略?

【问题讨论】:

    标签: android testing gradle


    【解决方案1】:

    似乎无法更改 Android 插件配置值。更多内容:https://discuss.gradle.org/t/lifecycle-of-extension/36604/2?u=eugene

    【讨论】:

      猜你喜欢
      • 2019-04-09
      • 1970-01-01
      • 2016-06-16
      • 2017-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-04
      • 1970-01-01
      相关资源
      最近更新 更多