【问题标题】:Android Instrumentation Test clearPackageData: 'true' does now write result to fileAndroid Instrumentation 测试 clearPackageData: 'true' 现在确实将结果写入文件
【发布时间】:2023-03-06 11:26:01
【问题描述】:

我使用 Espresso 进行了仪器测试。 我有一个测试观察器,它将结果写入设备 sdcard 中的文件,然后我将使用 adb 命令提取文件。

但是,当我使用 Orchestrator 并启用此配置时:

testInstrumentationRunnerArguments clearPackageData: 'true'

然后,它不会将结果写入 sdcard 中的文件。

有人知道为什么会这样吗?以及让它继续写入 sdcard 中的文件的任何解决方案?

谢谢。

【问题讨论】:

    标签: android instrumentation android-test-orchestrator


    【解决方案1】:

    这是因为每次测试都取消了权限。所以,我必须补充:

    InstrumentationRegistry.getInstrumentation().uiAutomation.executeShellCommand("pm grant com.traveloka.android.staging android.permission.WRITE_EXTERNAL_STORAGE")

    在我的测试观察者中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多