Skip to content

Use <test bundle id>.xctrunner for the UI test runner on devices - #3093

Merged
keith merged 1 commit into
bazelbuild:mainfrom
rohnnyjoy:device-xctrunner-bundle-id
Oct 26, 2026
Merged

keith merged 1 commit into
bazelbuild:mainfrom
rohnnyjoy:device-xctrunner-bundle-id

Conversation

@rohnnyjoy

Copy link
Copy Markdown
Contributor

ios_xctestrun_runner names the UI test runner com.apple.test.<test bundle name>-Runner. On a real device (iPhone 14 Pro, iOS 26.6.2, Xcode 26.6, wildcard development profile), bazel test of an ios_ui_test with --test_arg=--destination=platform=iOS,id=<udid> fails before any test runs:

FlightlinesUITests-Runner encountered an error: Failed to install or launch the test runner. (Underlying Error: Failed to create directory on device '…' (…) to hold runtime profiles for application with bundle ID 'com.apple.test.FlightlinesUITests-Runner': (null). (Underlying Error: The system failed to get the path on the remote device for the provided domain. (Underlying Error: The operation couldn't be completed. (ContainerLookupErrorDomain error 2.))))

Xcode names the runner <test bundle identifier>.xctrunner (wrappedBundleIdentifier in swift-build). This change uses that name when running on a device. The same identifier already flows into the runner's Info.plist, its entitlements and the xctestrun, so nothing else changes. Simulator runs keep com.apple.test.<name>-Runner.

Testing:

  • On the device above, with this change the runner installs and launches and the UI tests run.
  • bazel test //test:ios_xctestrun_runner_ui_test passes (15/15) on Xcode 26.6. Locally I had to switch the test's device_type from "iPhone Xs" to "iPhone 16", since iOS 26 simulators no longer support the Xs; that change is not in this PR.
  • Checked the device branch's plutil -extract against a built test bundle: my.bundle.idTests becomes my.bundle.idTests.xctrunner.

@rohnnyjoy
rohnnyjoy marked this pull request as ready for review October 1, 2026 16:23
Comment thread apple/testing/default_runner/ios_xctestrun_runner.template.sh Outdated
Xcode names a UI test runner <test bundle identifier>.xctrunner. A
device refuses the com.apple.test.<name>-Runner name rules_apple used:
no app under Apple's own prefix installs unless Apple signed it, the
install leaves no data container, and xcodebuild fails with
ContainerLookupErrorDomain error 2 before any test runs. The simulator
accepts either name, so the runner takes Xcode's on both.

A device run acquires no simulator, so it no longer calls the simulator
cleanup action after a successful test.
@rohnnyjoy

Copy link
Copy Markdown
Contributor Author

Done: the runner is <test bundle identifier>.xctrunner on the simulator too, no branch. Rebased on main.

@rohnnyjoy
rohnnyjoy force-pushed the device-xctrunner-bundle-id branch from aaaa338 to 12de0e3 Compare October 12, 2026 03:00
@keith
keith enabled auto-merge (squash) October 26, 2026 21:14
@keith
keith merged commit ff17cf8 into bazelbuild:main Oct 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants