In my project I am using the following commands to generate my app APK and instrumented test APK.
./gradlew :app:assembleDebug
./gradlew :app:assembleDebugAndroidTest
Using the generated files I am triggering a test in Test Lab using gcloud, which works without problems.
Now, I want to have annotations for the test size (small, medium, large), so only a subset of tests can be triggered in Test Lab, based on the test annotations.
Can it be done or is there a different approach to handle it?
 
                        
Yes, by using the
--test-targetsflag. It supports the same options as the-eflag for AndroidJUnitRunner.If you use the
SmallTest,MediumTest,LargeTestannotations fromandroid.support.test.filterspackage you can e.g. only run the small test the following way:Custom annotations are supported too:
For more options, take a look at the gcloud documentation for this command.