Reputation: 10148
In my Android application I have several test classes. If I run following command ./gradlew connectedAndroidTest
it runs all the test cases inside the android test folder and generate test report for all test classes but I need to test a specific test class and generate report for the test class I tried with the following command:
./gradlew test --tests com.login.user.UserLoginTest
The above command throws following exception
FAILURE: Build failed with an exception.
* What went wrong:
Problem configuring task :app:test from command line.
> Unknown command-line option '--tests'.
* Try:
Run gradlew help --task :app:test to get task usage details. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
My app gradle version is 3.3
Upvotes: 16
Views: 13121
Reputation: 311
It's possible that you are getting this error if you have multiple flavours in your project.
Instead of using just test
, try a specific test task:
./gradlew testDebugUnitTest --tests com.login.user.UserLoginTest
Upvotes: 26