-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic Android instrumented and unit tests (closes #2341) #2360
Basic Android instrumented and unit tests (closes #2341) #2360
Conversation
@robpridham-bbc Thank you so much for getting this of the ground! I refactored the PR slightly to make sure it ingrates with Unfortunately, I wasn't able to figure out how to run the instrumentation themselves from the command line. As I understand the, the instrumentation tests were the actual tests that were failing. I tried downgrading ByteBuddy to check that the tests are failing as expected, but none of them were. Based on https://spin.atomicobject.com/2016/03/10/android-test-script/ I understand that we would need to have a script that can boot up an emulator on CI and then run the corresponding scripts? At least that's what it told me when I ran I am fine if we land this as-is if we need more infrastructure changes to support these emulators. We probably want to add a separate GitHub action task to run these. However, it would be good to first verify that approach will work before we land this PR. WDYT? |
Interesting. Locally it builds just fine, but it claims that on JDK 11, the |
Codecov Report
@@ Coverage Diff @@
## main #2360 +/- ##
============================================
+ Coverage 84.88% 84.90% +0.02%
Complexity 2794 2794
============================================
Files 328 328
Lines 8480 8480
Branches 1025 1025
============================================
+ Hits 7198 7200 +2
Misses 1004 1004
+ Partials 278 276 -2
Continue to review full report at Codecov.
|
Ah. Seems like the memory increase worked and we got a green build 🎉 |
Subject to confirmation, Firebase might actually be a good option for this project. For us in our day jobs it costs money, but a very small amount as there's a free quota of daily execution minutes that we rarely exceed. |
Hm, I would prefer not to add any dependencies on external services such as Firebase. I will look into making a simple bash script that can do not. Not sure if that will work, but based on the blog post that maybe is feasible? |
The bash script article looks OK although it seems to assume an already created emulator image. You can create one at the command line too but it's a bit more involved. By the way, I feel I should probably point out that the migration into the top level project probably works fine from a Gradle point of view but it does mean it's not maintainable as a normal Android project any more, e.g. in Android Studio or as far as I'm aware IntelliJ. I'm not averse to what you've done; this is a balance between convenient integration into the main project (rather than being a weird Android-specific outlier) and making authoring any future extensions more difficult. However it might also have unwanted consequences. I think this is why you were seeing no exception messages for Lint. Similarly, in its current form it doesn't pass for me, and its output is totally opaque, although I haven't dug into why.
This is not normal - when I go back to my original commit and test against 3.11.2, I get proper output for the failure:
|
I wasn't able to work on this in the past two weeks. That said, I am inclined to merge this PR as-is and keep iterating on the bash script in a follow-up. Preferably we get at least some coverage for Android, although the real value will be in the instrumentation tests that will require an emulator to run. |
See #2341
Most of this PR is project overhead associated with a new Android project.
The primary benefit is providing basic instrumented tests which replicate failures seen in #2316, #2327 and #2340. Currently it only performs the most rudimentary establishment of some mocks; however, this is enough to produce these failures on the problematic versions.
I have included basic JUnit 4/5 non-instrumented tests which is perhaps unnecessary, given that more extensive tests exist in the non-Android subprojects, and there is nothing Android-specific about them. However I thought it might be valuable to have them exist within the context of the Android toolchain to provide basic assurance.
There is a README included with this, which may need further development to inform non-Android developers.