Reputation: 15726
When I want to start specific local unit test (in folder "test") I start (Dev is buildType):
gradlew testDevUnitTest --tests com.example.StringUtilTest.testMethod
OK. It's work.
But also I want to start specific instrumented test method (in folder "androidTest").
gradlew connectedDevAndroidTest --tests com.example.StringUtilTest.testSelectLanguageFragment
But I get error:
> Unknown command-line option '--tests'.
Upvotes: 10
Views: 2177
Reputation: 3272
You can run all tests in a specific test class like this
gradlew connectedDevAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.example.StringUtilTest
You can run a single test in a specific test class like this
gradlew connectedDevAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.example.StringUtilTest#testSelectLanguageFragment
More info at https://developer.android.com/studio/test/command-line.html
Upvotes: 11