, , , (sample repo):
1) buildConfigField uats:
Uats {
testInstrumentationRunner "com.quandoo.gradletestpoc.test.Instrumentation"
// passing instrumentation parameters
buildConfigField "String", "TAGS", "\"${getTagsProperty()}\""
}
2) getTagsProperty():
def getTagsProperty() {
return project.hasProperty("tags") ? project.getProperties().get("tags") : ""
}
3) onCreate() :
private static final String TAGS_KEY = "tags";
......
@Override
public void onCreate(final Bundle bundle) {
super.onCreate(bundle);
String tags = BuildConfig.TAGS;
if (!tags.isEmpty()) {
bundle.putString(TAGS_KEY, tags);
}
instrumentationCore.create(bundle);
start();
}
4)
./gradlew connectedAndroidTestUatsDebug -Ptags="@bar"
!