Jayesh Muralidharan
Jayesh Muralidharan

Reputation: 131

command line arguments to Android instrument test using gradle

Does anyone has an idea about how to pass command line arguments to Android instrumentation tests run using gradle. Calling gradle connectedInstrumentTest with -p arguments or -D arguments did n't seem to work .I am trying to pass command line arguments to my instrument test using gradle.

Upvotes: 8

Views: 2235

Answers (2)

Aleksei Potapkin
Aleksei Potapkin

Reputation: 1096

It is possible since 1.3.0 version of plugin according to docs: http://tools.android.com/tech-docs/new-build-system

It's now possible to specify instrumentation test runner arguments in build.gradle (in defaultConfig or per flavor):

android {
     defaultConfig {
         testInstrumentationRunnerArguments size: "medium"
     } 
 }

This can also be done on the command line:

./gradlew cC -Pandroid.testInstrumentationRunnerArguments.size=medium

Upvotes: 7

Xavier Ducrohet
Xavier Ducrohet

Reputation: 28549

you mean pass arguments to the am command? It's not possible at the moment.

Upvotes: 1

Related Questions