[英]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.