问题
I have a Espresso Android test APK with a lot of tests (about 70), and I wanted to split the tests into different APKs and then run them, separately, on Firebase Test Lab. Within the Android Studio framework, I created several Test Suites. However, when I need to generate an APK with fewer tests, I create several copies of the project and I will take tests and generate the APKs with the tests I need.
My question is:
- Is there any way to split the test APK without always having to do the previous process? That is, are there any mechanisms for generating the APK and specifying which tests (or how many tests) I want to include in my APK?
Many thanks, xptoGirl
回答1:
The easiest way doing this is with gcloud --test-targets. This way you do not have to split up your test APK. Rather you create multiple test runs in Test Lab but with different packages, annotations or classes that you want to test.
E.g. to only run tests in specific sub-packages:
gcloud firebase test android run \
--app path/to/app.apk \
--test path/to/tests.apk \
--device model=walleye,version=26 \
--test-targets "package com.my.package.tests1","package com.my.package.tests2"
来源:https://stackoverflow.com/questions/58641438/how-to-split-android-espresso-tests-into-different-apks