I have been tasked with adding Snapchat login to our Android app. Great, I've got it integrated and the login works (after some faffing about configuring it).
However, after I opened my PR, our CI flagged that the connectedAndroidTest
task was failing with the following message:
com.android.build.gradle.internal.testing.ConnectedDevice > No tests found.[Pixel_XL_API_26(AVD) - 8.0.0] FAILED
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':<app_name>:connectedDebugAndroidTest'.
> There were failing tests. See the report at: file:///C:/Users/<my_username>/StudioProjects/<project_name>/<module_name>/build/reports/androidTests/connected/index.html
I opened the report file, and it also stated that there were no tests found.
I have not touched, updated, opened or even dreamt about any test files whilst implementing this feature, and have certainly not changed anything about testing in our code base.
To prove this, I checked out dev, and ran the connectedAndroidTest
command from there, they all passed. Then, I simply added the following snapchat dependencies to the gradle file on dev:
implementation 'com.snapchat.kit.sdk:login:1.6.5'
implementation 'com.snapchat.kit.sdk:core:1.6.5'
Synced the project with gradle, and then ran the connectedAndroidTest
command again. This time, the tests fail with the "No tests found" error. So, no code change from me, just simply adding the snapchat dependencies is causing this issue.
What. On. Earth.
Really? Ok, so I've been pulling my hair out, scouring google for any advice and I've so far found nothing. So, I turn to StackOverflow; has anyone ever come accross such an issue? Any advice on how to start debugging and fixing this madness?
EDIT:
I have created a brand new, completely empty project, and can replicate this easily by just adding the snapchat dependencies.
Apparently when an apk is built for the instrumentation tests, it's missing some meta tags that are needed by the snapkit SDK
Adding an AndroidManifest.xml under the androidTest directory with only the following contents (even a not real client-id) resolves the issue.
If you need to write tests that will use the snapchat SDK maybe you will need to provide your real client-id and any other meta-tags your normal AndroidManifest has