如何解决测试在 TestLab 中失败,但在从 gradle 中传递来自 runner 的参数并在我的 androidTest 中使用它们时在本地传递
我正在通过 gradle 传递来自 runner 的参数,并在我的 androidTest 中使用它们。
''' 例如:
In build.gradle:
android {
defaultConfig {
testInstrumentationRunnerArguments 'FOO' :'foo'
}
}
In androidTest/foo.java
username= androidx.test.platform.app.InstrumentationRegistry.getArguments().getString("FOO");
测试在本地运行,但在 Firebase TestLab 中运行时,当我尝试使用 key=FOO 访问参数时,出现空指针异常并且测试失败。你能帮我解决这个问题吗。
我不想使用 CLI。如果有什么方法可以使用 android studio 和 firebase testlab web UI 做到这一点,请告诉我。
解决方法
You can pass them in by running tests thru the command line:
使用 --environment-variables
选项。
gcloud firebase test android run \
--type instrumentation \
--app app-debug.apk \
--test app-debug-test.apk \
--environment-variables FOO=foo
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。