Exit course
Chapter 4 of 10 Beginner 5 min read 2 quick checks Updated

Uploading and Managing App Builds

On this page
  1. Which file goes where
  2. iOS signing on a device cloud
  3. Getting the build to the device
  4. The CLI uploads for you
  5. Keep track of which build ran

A web test points a browser at a URL. A mobile test first has to install the right build of your app on the device. Most "the test fails before it starts" problems on a device cloud come down to the wrong artefact, an expired upload or a build that cannot be installed on the device you asked for. This chapter sorts that out once.

Which file goes where#

Target File Built with
Android emulator or phone .apk (or .aab) Gradle, for example ./gradlew assembleDebug
iOS Simulator the .app bundle, zipped xcodebuild -sdk iphonesimulator
Physical iPhone or iPad signed .ipa Xcode archive and export (Ad Hoc, Development or Enterprise)

Two details catch people out:

  • Native code has to match the CPU. An Android app with native libraries built only for ARM will not install on an x86 emulator, and the other way round. TestingBot's Prepare your app page lists what each target needs.
  • Simulator and device builds are different artefacts. You cannot turn one into the other by renaming or zipping, as chapter 1 showed.

Native frameworks need a second file: Espresso needs the test APK (./gradlew assembleDebugAndroidTest), XCUITest needs the -Runner.app from a build-for-testing, zipped. Chapter 6 uses both kinds.

iOS signing on a device cloud#

A development-signed .ipa normally only installs on the devices listed in its provisioning profile, and those are not the cloud's phones. TestingBot therefore re-signs uploaded .ipa files with its own profile so they can be installed. Re-signing removes the app's entitlements, which means features that depend on them (push notifications, universal links, some keychain sharing) do not work in a re-signed build. If you need those, sign the app through the Apple Developer Enterprise Program and turn re-signing off with resigningEnabled: false; see iOS app re-signing.

Your push notification test passes on your own iPhone but the notification never arrives on a cloud iPhone, while every other test passes. What is the most likely reason?

Re-signing lets a development build install on the cloud's devices, but it strips entitlements such as push. A simulator build would not install at all, and waiting longer does not bring back an entitlement.

Getting the build to the device#

There are two ways to give a cloud device your app.

A public URL. Point the test at any HTTPS link: 'appium:app': 'https://testingbot.com/appium/sample.apk'. It is the quickest way to try something, and the TestingBot sample apps are hosted this way. Every session downloads the file from that server, so it has to be reachable from the device cloud and fast.

TestingBot Storage. Upload the file once and use the returned tb:// id. The app stays private and devices download it from TestingBot's own network, so sessions start faster. Uploading the calculator app:

curl -u "$TB_KEY:$TB_SECRET" \
  -X POST "https://api.testingbot.com/v1/storage" \
  -F "file=@sample.apk"
{"app_url":"tb://c4a7a3347e4af6304bbca538"}

Pass that value as appium:app instead of the URL. Chapter 4's test reads it from an environment variable, and it ran against this exact upload. To see what you have uploaded:

curl -u "$TB_KEY:$TB_SECRET" "https://api.testingbot.com/v1/storage?offset=0&count=2"

Each entry shows the app_url, the file name, the platform (ANDROID or IOS) and the upload time. The storage API can also replace a file behind an existing id and delete uploads.

Uploads are deleted automatically after 60 days. Hard-coding a tb:// id in a nightly job works for two months and then fails at session start. Upload from CI on every build instead, and pass the fresh id to the test run.

Your test job always runs against tb://... from an upload your colleague made by hand last month. Apart from expiry, what is wrong with that?

A device test is only as useful as the build it installs. Upload the artefact produced by the same pipeline run, so every result belongs to a known commit; the id works on emulators, simulators and real devices alike.

The CLI uploads for you#

With the TestingBot CLI, used for Maestro, Espresso and XCUITest in chapters 5 and 6, you pass local file paths and it uploads them as part of the run:

npx @testingbot/cli@1.5.0 espresso app-debug.apk app-debug-androidTest.apk \
  --device "Pixel 8" --platform-version "14" \
  --name "Calculator Espresso" --build "course-mobile-app-testing"

For Maestro, the CLI prints a project id after the upload ("reuse this app later with --app-binary-id") and skips uploading a file it has already seen, which saves time when you re-run flows against the same build.

Keep track of which build ran#

Whatever the route, make every run say which build it tested. Put the version or commit in the build name (tb:options.build for Appium, --build for Espresso and XCUITest, --name for Maestro). When a test fails next week, the first question is always "which build was that", and the answer should be on the dashboard, not in someone's memory.