I\'m using espresso for testing but sometimes I try to get an image form external storage and with marshmallow I need a Runtime permission otherwise there will be an Excepti
You can use GrantPermissionRule. This rule will grant all the requested runtime permissions for all test methods in that test class.
@Rule public GrantPermissionRule mRuntimePermissionRule = GrantPermissionRule.grant(Manifest.permission.READ_PHONE_STATE);