繁体   English   中英

Android Gradle任务:版本构建的connectedInstrumentTest?

[英]Android Gradle task: connectedInstrumentTest for Release Build?

有没有办法针对Release构建类型或任何其他自定义构建变体运行测试?

connectedInstrumentTest任务的默认行为是仅针对Debug构建变​​体运行测试

有任何想法吗?

AFAIK connectedInstrumentTest针对使用testBuildType属性指定的构建类型运行。 您可以尝试从命令行参数中进行动态读取:

android {
    testBuildType obtainTestBuildType()
}

def obtainTestBuildType() {
    def result = "debug";

    if (project.hasProperty("testBuildType")) {
        result = project.getProperties().get("testBuildType")
    }

    result
}

然后用它来调用它

./gradlew connectedInstrumentTest -PtestBuildType=release

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM