← Back to Pull requests

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

Open
rohnnyjoy opened this pull request with 10 lines diff across 1 files
View on GitHub
rohnnyjoy rohnnyjoy commented on Oct 01, 2026 15:34 UTC
Author

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.
  • Diff: 10 lines (+9 / -1) across 1 files Reviewer: keith Review duration: 1057m
    All Vouch review confidence checks passed
    Residual risk 0.02 = Change Risk (0.17) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.17 · 10 lines diff across 1 files
    0.17
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.89 · 1 substantive comment(s)
    0.89
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    89%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.143
    Real PR Conversation Timeline
    2 items
    keith keith commented on code on Oct 01, 2026 16:54 UTC
    Code Review
    apple/testing/default_runner/ios_xctestrun_runner.template.sh:1
    @@ -205,7 +205,15 @@ if [[ -n "$test_host_path" ]]; then
         cp -R "$libraries_path/Xcode/Agents/XCTRunner.app" "$runner_app_destination"
         chmod -R 777 "$runner_app_destination"
         xctestrun_test_host_path="__TESTROOT__/$runner_app"
    -    xcrun_test_host_bundle_identifier="com.apple.test.$runner_app_name"
    +    if [[ "$build_for_device" == true ]]; then
    +      # Devices fail to create a data container for a runner under the
    +      # com.apple.test prefix (ContainerLookupErrorDomain error 2), so use
    +      # Xcode's naming for the runner: <test bundle identifier>.xctrunner.
    +      test_bundle_identifier=$(/usr/bin/plutil -extract CFBundleIdentifier raw -o - "$test_tmp_dir/$test_bundle_name.xctest/Info.plist")

    lets just use this for the simulator too to avoid the branch, seems legit to me

    Reviewers
    Assignees
    rohnnyjoy rohnnyjoy
    Labels
    risk: low confidence: 89.1% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 17.3% (LOW) · Higher = larger blast radius
    17.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 89.1% · Lower = rushed or shallow review
    89.1%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 2% · Safe to merge
    2%