Firebase Test Lab instrumented test for test method annotated by size

313 views Asked by At

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?

1

There are 1 answers

0
Maik On BEST ANSWER

Yes, by using the --test-targets flag. It supports the same options as the -e flag for AndroidJUnitRunner.

If you use the SmallTest, MediumTest, LargeTest annotations from android.support.test.filters package you can e.g. only run the small test the following way:

gcloud firebase test android run --test-targets "size small" <your other flags>

Custom annotations are supported too:

gcloud firebase test android run --test-targets "annotation com.example.MyAnnotation

For more options, take a look at the gcloud documentation for this command.