Pull Files
You can pull any data generated during the tests using --directories-to-pull.
This is useful if your test generates any extra data like screenshots, logs,
data snapshots, etc.
NoteIf you run your tests with coverage there’s no need to explicitly download the coverage files, use--with-coverageinstead and emulator.wtf will grab code coverage data automatically. Read more here.
Output location
The folders will be pulled from the emulator once the test has finished and
written to the path indicated by --outputs-dir. For example, if your app
captures screenshots to /sdcard/Download/screenshots during the test you can
pull them using the combination of --directories-to-pull /sdcard/Download/screenshots --outputs-dir /tmp/foo. In this case the screenshots will be downloaded to
/tmp/foo/sdcard/Download/screenshots after the test has finished.
Grabbing multiple folders
Use comma-separated values to pull multiple locations, e.g. to pull both
/sdcard/screenshots/ and /sdcard/test-logs you can write
--directories-to-pull /sdcard/screenshots,/sdcard/test-logs.
Configuring your app for writing
To write to the /sdcard/ folder your debug or androidTest manifest needs
the WRITE_EXTERNAL_STORAGE permission:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
If you’re also using the test orchestrator together with clear package data,
you’ll need to reacquire this permission before every test runs using a @Rule:
@get:Rule
val writeRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE)
@Rule
public GrantPermissionRule writeRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE);