Skip to content

scaffold-ios: scheme references a test plan file that is never generated #503

Description

@farazbukhari98

Summary

scaffold-ios generates a shared scheme whose <TestPlans> section references container:<Name>.xctestplan, but that file is never generated. Running tests fails with: Tests cannot be run because the test plan "<Name>" could not be read.

Environment

  • xcodebuildmcp 2.6.0
  • Xcode 26.4 (Build 17E192)
  • macOS 26.4.1

Reproduction

  1. Scaffold a project:
xcodebuildmcp project-scaffolding scaffold-ios --project-name SmokeTest --output-path /tmp/smoke --bundle-identifier com.example.smoke
  1. (Apply the missing-package-reference fix from the other scaffold issue so the project builds.)
  2. Run tests:
xcodebuildmcp simulator test --workspace-path /tmp/smoke/SmokeTest.xcworkspace --scheme SmokeTest --simulator-name "iPhone 17 Pro"

Expected

Tests run. The scheme's test action should use the test plan that does exist (<Name>/<Name>.xctestplan, which is generated and contains both the package test target and the UI test target).

Actual

Errors (1):
  ✗ Failed to build workspace SmokeTest with scheme SmokeTest.: Tests cannot be run because the test plan "SmokeTest" could not be read.

Diagnosis

The generated scheme (<Name>.xcodeproj/xcshareddata/xcschemes/<Name>.xcscheme) contains two TestPlanReference entries:

  • container:<Name>.xctestplan — not generated, causes the failure
  • container:<Name>/<Name>.xctestplan — generated, marked default = "YES"

Xcode refuses to run the test action while any referenced plan is unreadable.

Fix (verified on 2.6.0)

Remove the dangling TestPlanReference for container:<Name>.xctestplan, keeping only the existing <Name>/<Name>.xctestplan entry. After this, the test run succeeds: 3 tests discovered and passing (2 Swift Testing package tests + 1 UI test), with a readable .xcresult.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions