I want to run JUnit tests against my library and I want to ask the user to provide all the necessary permissions before starting the test (because I need, for example, to read some files from the device storage during automatic tests).
I know how to do this by adding a task to gradle and running it from cmd, it works well. But I need to ask the user (or do it automatically) when I conducted the tests using the IDE .
I tried to add a permission request to the MainActivity.onCreate () of the test application, but no luck, because MainActivity does not run for all tests.
Does anyone have any ideas?
Also, do not talk about adding a gradle grant task to the execution configuration. it works, but is unusable, needs something more unified.
java android android-6.0-marshmallow android-permissions junit
pbelov
source share