【问题标题】:Is it possible to have a separate module for instrumented tests in android是否可以在 android 中有一个单独的模块用于仪器测试
【发布时间】:2020-05-29 01:52:15
【问题描述】:
【问题讨论】:
标签:
android
instrumented-test
【解决方案1】:
这是可能的。可能有比我将要建议的更简单的方法,但您可以实施 conditionally ignores test 规则并在 CI 作业中更改此变量的值。
有不同的方法。
1)通过存储在服务器中的布尔值确定要运行的测试。因此,使用条件shouldUITest 和其他shouldInstrumentationTest 标记您的正常 ui 测试,并在服务器中更改它们的值
2) 使用 buildflavors 更改 app.gradle 中的变量。 (基本上创建 2 个不同的变体并运行您想要的任何一个
3)检测构建是CI构建,并在app.gradle中采取相应措施
def ciBuild= System.getenv("CI") == "true"
if (ciBuild) {
//Do stuff
}