如何在Firebase测试实验室中检测运行情况 [英] How to detect running in Firebase Test Lab
问题描述
我最近在Firebase中发现了我的应用设置问题.我们配置了发布前报告,这意味着测试实验室设备正在为我们的分析贡献大量匿名会话.
I've discovered a problem recently with my app's setup in Firebase. We have the pre-launch report configured, which means that the test lab devices are contributing a large number of anonymous sessions to our analytics.
是否有任何方法可以检测到设备正在运行这些测试?例如,将 isUserAMonkey 或
Is there any way to detect that a device is running these tests? For example, will isUserAMonkey or isRunningInTestHarness return true for tests in the test lab? This would allow me to adjust the configuration of my analytics/etc if so.
推荐答案
这实际上是在文档中提到的="nofollow noreferrer">.
This is actually mentioned in the docs.
您可以检查是否存在名为"firebase.test.lab"的系统属性:
You can check for the existence of 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
}
这篇关于如何在Firebase测试实验室中检测运行情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!