Recently I've added a few more Espresso tests to my Firebase Android App, so the total time of running them on emulator grew up to something like 8 minutes.
Now whenever I'm trying to run our Espresso tests in Firebase Test Lab, the app always gets killed by Android OS for various reasons. Examples:
running on Nexus 5 emulator, API 23: about 6 minutes after the test starts,
com.google.android.gms
gets an update and kills the test in progress:D/PackageManager(1678): Renaming /data/app/vmdl517737698.tmp to /data/app/com.google.android.gms-2 I/ActivityManager(1678): Force stopping com.google.android.gms appid=10008 user=-1: replace sys pkg I/ActivityManager(1678): Killing 1970:com.google.android.gms.persistent/u0a8 (adj 1): stop com.google.android.gms W/PackageManager(1678): Trying to update system app code path from /data/app/com.google.android.gms-1 to /data/app/com.google.android.gms-2 <...> I/ActivityManager(1678): Killing 5654:org.example.MyApplication/u0a84 (adj 0): stop com.google.android.gms
surprised, I tried running on Nexus 5 emulator, API 19 (my minSdkVersion is 15): about 20 seconds (!) after the test starts, a weird message about some Chimera API shows up and kills my up "to update a config":
E/ModuleProvider(4927): Unhandled query from org.example.MyApplication: content://com.google.android.gms.chimera/api/ I/ChimeraModuleLdr(5546): Module config changed, forcing restart due to module I/Process(5546): Sending signal. PID: 5546 SIG: 9
Of course the Firebase Test Lab immediately notices the process being killed and responds by marking the test "failed" with reason: Process crashed
.
My question is: how can I deal with this behavior of Android OS in Firebase test lab? Creating a junit retry @Rule doesn't help - the whole process is killed, not leaving any chance for retries to kick in.
Turns out this was a temporary (well, spanning for at least about a month) issue in Firebase Test Lab. I got in touch with Firebase Support and they kept me posted weekly until it was resolved.