I am trying to run an instrumented unit tests for Android Pie. The test I am building will test the access to expansion files delivered via Play Store APK Expansion files. In manual test this works, but that's, well, manual.
To run the test I push the file over to the emulator:
adb push obb/main.45.org.example.someapp.obb /storage/emulated/0/Android/obb/org.example.someapp/main.45.org.example.someapp.obb
and run tests with gradle connectedFreeDebugAndroidTest
. Gradle compiles everything nicely and copies the APK over to the emulator. However, during this process, it seems the expansion file is also cleaned off the device:
> Task :app:connectedFreeDebugAndroidTest
01:18:05 V/ddms: execute: running am get-config
01:18:05 V/ddms: execute 'am get-config' on 'emulator-5554' : EOF hit. Read: -1
01:18:05 V/ddms: execute: returning
01:18:05 D/app-free-debug.apk: Uploading app-free-debug.apk onto device 'emulator-5554'
01:18:05 D/Device: Uploading file onto device 'emulator-5554'
01:18:05 D/ddms: Reading file permision of /tmp/gradle/someapp-android/app/outputs/apk/free/debug/app-free-debug.apk as: rw-r--r--
01:18:05 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-free-debug.apk"
01:18:05 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-free-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
01:18:05 V/ddms: execute: returning
01:18:05 V/ddms: execute: running rm "/data/local/tmp/app-free-debug.apk"
01:18:05 V/ddms: execute 'rm "/data/local/tmp/app-free-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
01:18:05 V/ddms: execute: returning
01:18:05 D/app-free-debug-androidTest.apk: Uploading app-free-debug-androidTest.apk onto device 'emulator-5554'
01:18:05 D/Device: Uploading file onto device 'emulator-5554'
01:18:05 D/ddms: Reading file permision of /tmp/gradle/someapp-android/app/outputs/apk/androidTest/free/debug/app-free-debug-androidTest.apk as: rw-r--r--
01:18:05 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-free-debug-androidTest.apk"
01:18:06 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-free-debug-androidTest.apk"' on 'emulator-5554' : EOF hit. Read: -1
01:18:06 V/ddms: execute: returning
01:18:06 V/ddms: execute: running rm "/data/local/tmp/app-free-debug-androidTest.apk"
01:18:06 V/ddms: execute 'rm "/data/local/tmp/app-free-debug-androidTest.apk"' on 'emulator-5554' : EOF hit. Read: -1
01:18:06 V/ddms: execute: returning
01:18:06 I/RemoteAndroidTest: Running am instrument -w -r -e coverageFile /data/data/org.example.someapp/coverage.ec -e coverage true org.example.someapp.test/android.support.test.runner.AndroidJUnitRunner on Pixel_2_API_28_Android_Pie_(AVD) - 9
01:18:06 V/ddms: execute: running am instrument -w -r -e coverageFile /data/data/org.example.someapp/coverage.ec -e coverage true org.example.someapp.test/android.support.test.runner.AndroidJUnitRunner
...
01:18:07 V/InstrumentationResultParser: Caused by: java.io.FileNotFoundException: /storage/emulated/0/Android/obb/org.example.someapp/main.45.org.example.someapp.obb: open failed: ENOENT (No such file or directory)
How can I make sure this file exists when tests run?
Aucun commentaire:
Enregistrer un commentaire