We have a library project, and many applications depend on it. And unit tests are in the library project. We can run tests from dependent projects in Android Studio, but
./gradlew :[DependentProject]:connectedAndroidTest
always returns "No test, nothing to do."
Thanks to the observation I found in Android Studio, it seems that it only performs gradle tasks:
:[DependentProject]:assembleDebug, :[DependentProject]assembleDebugTest
then uses adb to install the target and test apk applications and adb shell am to run the tests.
Since connectedAndroidTest depends on these two tasks, I install the target and test apk that he created, and the tool command is called manually, the tests started.
adb shell am instrument -w com.package.test/android.test.InstrumentationTestRunner
The question then becomes, where does connectAndroidTest look for tests and why can't it find tests while the adb tool can? How to solve this problem?
android android-studio android-gradle gradle android-testing
Sugar
source share