Issue
I want to use separate set of Resources while running test, so I set up a file named 'configs.xml' in
'src/androidTest/res/values'
and added this to gradle
sourceSets { androidTest { resources.srcDirs = ['src/androidTest/res'] } } }
But when I try to fetch the resource using the below line
String s1 = getInstrumentation().getContext().getResources().getString(R.string.test_config);
I get this below error
01-08 18:06:13.814 16761-16774/com.example.hellodroid I/TestRunner﹕ android.content.res.Resources$NotFoundException: String resource ID #0x7f070008 at android.content.res.Resources.getText(Resources.java:1382) at android.content.res.Resources.getString(Resources.java:1476)
Can somebody point out where I am going Wrong ??
Solution
In your build.gradle file, this should work:
sourceSets {
instrumentTest.setRoot('tests')
}
This allows, I believe, tests/java, tests/res folders etc.
Answered By - shkschneider
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.