Closed alex-iotiq closed 1 year ago
The last one should work starting with https://github.com/DaGeRe/peass/commit/b803de7dc18e8b80c06c259cd39138ea8b02378b
Adding the rule now also works: https://github.com/DaGeRe/peass/commit/f68feef3a69ee5fcf5dcba6ad91cc9ddb6a16409
To be able to write/read files inside the emulator (for temporary results), you have to add permissions. Usually those permissions have to be granted at runtime, but with tests you can add a special rule to grant them automatically.
First you need to add permissions
to
app/src/main/AndroidManifest.xml
:And then adding permission rules to the tests which are run like this:
WRITE_EXTERNAL_STORAGE
permission will automatically grantREAD_EXTERNAL_STORAGE
.ClassRule
will grant the permissions before the test is executed, becausebuild.gradle
is being read before the executionAdd dependency to
app/build.gradle
(related #171):This means there are 3 requirements:
AndroidManifest.xml
automatically (Unit test implementation + usage in code)ClassRule
androidx.test:rules