Skip to content Skip to sidebar Skip to footer

Running Instrumented Android Test Produces "unknown Command-line Option '--tests' "

I need to run tests with Gradle in a specific package of my app with a command line, in a fastfile. I'm using this command sh './gradlew test --tests 'com.package.exemple.*'' but

Solution 1:

There is an open issue related to this problem. Please star it and use a specific variant name.

Currently the top-level "test" task doesn't accept the "--tests" argument. Instead, you must run the explicit "test" task for a specific variant (e.g. "testDebugUnitTest").

The syntax you are using is correct as documented in the Gradle User Guide.

But it seems the VariantName can be mandatory as suggested here.

You can find an example in the Android Developers Documentation.

Gradle also allows you to target specific tests using the --tests flag. For example, the following command runs only the sampleTestMethod tests for the specified build variant...

./gradlew testVariantName --tests *.sampleTestMethod

Post a Comment for "Running Instrumented Android Test Produces "unknown Command-line Option '--tests' ""