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.
You can do gradle -Dtest. single=ClassUnderTestTest test if you want to test single class or use regexp like gradle -Dtest. single=ClassName*Test test you can find more examples of filtering classes for tests under this link.
In order to run the instrumentation test, you need to select Android Instrumentation Tests under Test Artifact in the Build Variants window. You should see the project structure change and the classes under the androidTest folder should now be visible.
We can run our unit tests by using the command: gradle clean test.
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
you mean pass arguments to the am command? It's not possible at the moment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With