简体   繁体   中英

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:

Shards need to be independent!

Two shards created by your implementation of split in your runner

should not have dependencies on each other or share resources .

Also see InstalledInstrumentationsTest.java .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM