command line arguments to Android instrument test

2019-04-28 05:06发布

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.

2条回答
Animai°情兽
2楼-- · 2019-04-28 05:41

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

查看更多
我想做一个坏孩纸
3楼-- · 2019-04-28 05:46

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

查看更多
登录 后发表回答