Running filtered androidTests from gradle command line


The espresso test runner has some parameters which can be used from the gradle command line to filter tests.

Run all tests in the given package.


Run all tests in the given test class.


Run an individual test method.



Run all tests in a package.

./gradlew connectedTests

Run all tests in a class

./gradlew connectedTests

 Run an individual test method.

./gradlew connectedTests


Test outputs are found in the module’s build/reports/androidTests/connected/ directory.

Other gradle tasks.

If you have other gradle tasks that run the connected android tests, you can pass the parameters to those too. For example, if you are generating jacoco coverage reports you can generate the report for just what you are working on. This can be done within the android studio “Run Configurations”.

Leave a Reply

Your email address will not be published. Required fields are marked *