command line arguments to Android instrument test using gradle

android, automated-tests, command-line-arguments, gradle

Solution

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

Problem

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.

Original source