简体   繁体   English

android.content.res.Resources$NotFoundException:作为分片的一部分运行测试时的字符串资源 ID Resources.getText

[英]android.content.res.Resources$NotFoundException: String resource ID Resources.getText when running test as part of shard

During an instrumentation test i request the context the following way在仪器测试期间,我通过以下方式请求上下文

val context = ApplicationProvider.getApplicationContext<Context>()

then somewhere in the test i do然后在测试的某个地方我做

device.waitForText(context.getString(R.string.someString))

This works well when I run the test as a single test and when I run the test as part of a test suite.当我将测试作为单个测试运行以及作为测试套件的一部分运行测试时,这很有效。

However, I want to expedite the testing procedures with test sharding但是,我想通过测试分片加快测试过程

And when i invoke the tests as shards, i get an exception:当我将测试作为分片调用时,出现异常:

android.content.res.Resources$NotFoundException: String resource ID #0x7f1300e5at android.content.res.Resources.getText(Resources.java:367)

How to fix it?如何解决?

Write a Sharded IRemoteTest Test Runner reads: 编写一个分片 IRemoteTest 测试运行程序读取:

Shards need to be independent!分片需要独立!

Two shards created by your implementation of split in your runner由您在跑步者中实施 split 所创建的两个分片

should not have dependencies on each other or share resources .不应相互依赖或共享资源

Also see InstalledInstrumentationsTest.java .另请参阅InstalledInstrumentationsTest.java

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android:android.content.res.Resources $ NotFoundException:字符串资源ID - Android: android.content.res.Resources$NotFoundException: String resource ID android.content.res.Resources$NotFoundException · 字符串资源 ID # - android.content.res.Resources$NotFoundException · String resource ID # android.content.res.Resources$NotFoundException:字符串资源 ID - android.content.res.Resources$NotFoundException: String resource ID android.content.res.resources notfoundexception $ android.content.res.resources notfoundexception $字符串资源ID#0x1 - android.content.res.resources notfoundexception $android.content.res.resources notfoundexception $ string resource id #0x1 android.content.res.Resources $ NotFoundException:资源ID#0x0 - android.content.res.Resources$NotFoundException: Resource ID #0x0 android.content.res.Resources $ NotFoundException:资源ID#0x0 - android.content.res.Resources$NotFoundException: Resource ID #0x0 android.content.res.Resources $ NotFoundException:资源ID#0xffffffff - android.content.res.Resources$NotFoundException: Resource ID #0xffffffff android.content.res.Resources $ NotFoundException:无法找到资源ID - android.content.res.Resources$NotFoundException: Unable to find resource ID 缺少资源 ID android.content.res.Resources$NotFoundException:字符串资源 ID #0xb - missing resource id android.content.res.Resources$NotFoundException: String resource ID #0xb Android:android.content.res.Resources$NotFoundException:字符串资源 ID #0x5 - Android: android.content.res.Resources$NotFoundException: String resource ID #0x5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM