I have made a text file of values that I want to use for testing in res/raw
I want to use them in testing
I am using robolectric
What is the best way of accessing these values?
Thanks
I have made a text file of values that I want to use for testing in res/raw
I want to use them in testing
I am using robolectric
What is the best way of accessing these values?
Thanks
You can access your app's resources via your Application instance. Use ApplicationProvider to fetch it from within a unit test:
// replace 'Application' with your actual class if you use a custom one
ApplicationProvider.getApplicationContext<Application>().resources
Ensure includeAndroidResources is set to true in your build.gradle or your unit tests won't see your resources:
android {
testOptions.unitTests.includeAndroidResources true
}