How to detect launch in Firebase Test Lab

I recently discovered an issue setting up my app in Firebase. We've got a pre-launch report set up, which means test lab devices are contributing to a lot of anonymous sessions for our analytics.

Is there a way to detect if the device is performing these tests? For example isUserAMonkey or isRunningInTestHarness return true for tests in a test lab? This would allow me to tweak my analytics / etc configuration if so.

+3


source to share


1 answer


This is actually mentioned in the docs .

You can check for a system property called "firebase.test.lab":



String testLabSetting =
  Settings.System.getString(context.getContentResolver(), "firebase.test.lab");
if ("true".equals(testLabSetting)) {
  // Do something when running in Test Lab
}

      

+5


source







All Articles