AutomateMobileEspresso
Uploading APKs
Upload your app APK and your androidTest APK, and get the two farm:// URLs a build needs.
A build needs two uploads. Each one gives you a farm:// URL to use when you start a build.
| The app | The test suite | |
|---|---|---|
| Gradle task | assembleDebug | assembleDebugAndroidTest |
| File | app-debug.apk | app-debug-androidTest.apk |
| Upload to | POST /espresso/v1/app | POST /espresso/v1/test-suite |
| You get | app_url (farm://app-…) | test_suite_url (farm://suite-…) |
Upload in one call
curl -u "x:$TESTKASE_ACCESS_KEY" -F "[email protected]" https://hub.testkase.com/espresso/v1/app
curl -u "x:$TESTKASE_ACCESS_KEY" -F "[email protected]" https://hub.testkase.com/espresso/v1/test-suiteThe upload must finish within five minutes. For a big APK or a slow connection, use the direct upload below.
Direct upload (large APKs and CI)
This sends the file straight to our storage, up to 500 MB. It takes three calls and returns the same app_url:
APK=app/build/outputs/apk/debug/app-debug.apk
# 1. ask for an upload URL
R=$(curl -s -u "x:$TESTKASE_ACCESS_KEY" -H "Content-Type: application/json" \
-d "{\"sizeBytes\": $(wc -c < "$APK"), \"filename\": \"app-debug.apk\"}" \
https://hub.testkase.com/espresso/v1/app/upload-url)
# 2. PUT the APK to that URL (no TestKase key here)
curl -f -X PUT -H "Content-Type: application/vnd.android.package-archive" \
--upload-file "$APK" "$(echo "$R" | jq -r .upload_url)"
# 3. commit
curl -u "x:$TESTKASE_ACCESS_KEY" -H "Content-Type: application/json" \
-d "{\"upload_id\": \"$(echo "$R" | jq -r .upload_id)\"}" \
https://hub.testkase.com/espresso/v1/app/commitFor the test suite, use /espresso/v1/test-suite/upload-url and /espresso/v1/test-suite/commit the same way. Do the PUT within 15 minutes and the commit within an hour. The script uses jq.
Good to know
- Only
.apkfiles. Upload a single universal.apk, not an.aabor.apks. - Uploads last 90 days. Most CI pipelines simply upload both APKs on every run.
- 10 apps and 10 test suites. When a library is full, your oldest API upload is replaced automatically.
- The test suite must be built for the app. Its target package must match the app's package, otherwise the build is refused.
Listing, deleting and every error code are in the API reference: upload app, upload test suite, direct upload, list apps, delete an app.
