Skip to content

feat(testing): Support reusable prepared test artifacts#475

Open
cameroncooke wants to merge 24 commits into
mainfrom
codex/feat/issue-450-build-for-testing
Open

feat(testing): Support reusable prepared test artifacts#475
cameroncooke wants to merge 24 commits into
mainfrom
codex/feat/issue-450-build-for-testing

Conversation

@cameroncooke

@cameroncooke cameroncooke commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

This adds a build-once, test-later workflow to XcodeBuildMCP. A caller can prepare test products, keep the resulting artifacts, and run those tests later without compiling again.

What changes for users

  • Simulator, physical-device, and macOS build tools accept buildForTesting.
  • Successful prepared builds return the managed test-products bundle and the discovered .xctestrun files.
  • Test tools can run either those prepared products or an explicit .xctestrun file without rebuilding.
  • The run returns its own result bundle, so callers can inspect the result of that specific test run.
  • Normal builds and normal test commands keep their existing behaviour.

Supporting work in this PR

The PR also makes snapshot tests set up and clean up their own simulator, device, and macOS app state through shared preflight helpers. It does not delete simulators or alter machine-wide Xcode configuration. The helpers now tolerate a simulator boot or shutdown that races with test cleanup.

Verification

  • Unit suite: 2,881 tests passed
  • Schema fixtures: 321 passed
  • UI-automation snapshot suite: 44 passed (using a per-command Xcode 26.5 selection)
  • Type check, format check, lint, and build passed

Fixes #450

Extend existing build and test tools to prepare, return, and consume reusable test artifacts while preserving normal build behavior.

Fixes #450
Move conditional next-step selection into tool manifests and preserve the behavior across MCP, CLI, daemon, and snapshot outputs.

Refs #450
@pkg-pr-new

pkg-pr-new Bot commented Jul 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/xcodebuildmcp@475

commit: bdbfb28

@cameroncooke
cameroncooke marked this pull request as ready for review July 16, 2026 16:19
Comment thread src/snapshot-tests/__fixtures__/cli/text/macos/test--failure.txt
Comment thread src/utils/test-common.ts
Keep source-only xcodebuild arguments out of the generated test-without-building phase and sort final test failures independently of emission order.
Comment thread src/mcp/tools/device/build_device.ts
Comment thread src/mcp/tools/device/build_device.ts
Comment thread src/utils/test-common.ts Outdated
Comment thread src/utils/test-common.ts
Share per-test environment setup and cleanup across snapshot suites, cache suite-level simulator builds, and normalize volatile output so fixtures remain stable. Update non-environmental fixtures and add coverage for cleanup and normalization behavior.
Comment thread src/snapshot-tests/preflight/simulator.ts Fixed
Comment thread src/utils/test-source.ts
Comment thread src/utils/test-common.ts
Comment thread src/snapshot-tests/__fixtures__/cli/json/swift-package/run--success.json Outdated
Comment thread src/snapshot-tests/__fixtures__/cli/text/macos/stop--success.txt
Prevent session defaults and selectors from leaking into prepared test runs, remove a useless simulator state initializer, and align volatile snapshot fixtures across CLI and MCP.
Comment thread src/utils/test-source.ts
Comment thread src/mcp/tools/macos/build_macos.ts
Keep only-testing and skip-testing arguments in the prepared test phase while retaining session-default conflict filtering.
Comment thread src/mcp/tools/device/build_device.ts
Comment thread src/snapshot-tests/__fixtures__/cli/json/simulator-management/list--success.json Outdated
Comment thread src/snapshot-tests/__fixtures__/cli/json/ui-automation/long-press--success.json Outdated
Comment thread src/utils/test-common.ts
Comment thread src/utils/typed-tool-factory.ts
Comment thread src/mcp/tools/device/build_device.ts
Comment thread src/snapshot-tests/__fixtures__/cli/json/simulator-management/list--success.json Outdated
Comment thread src/snapshot-tests/__fixtures__/cli/json/swift-package/run--success.json Outdated
Comment thread src/snapshot-tests/__fixtures__/cli/text/device/test--success.txt
Comment thread manifests/tools/build_sim.yaml
Retry app cleanup after a concurrent simulator shutdown and tolerate a boot that completes between the state check and boot command.
Comment thread src/mcp/tools/device/build_device.ts
Update the discovery schema expectation and keep device and macOS fixtures aligned with the generated artifacts.
Comment thread src/snapshot-tests/preflight/simulator.ts
Treat an already-shut-down simulator as successful cleanup and align compiler-failure fixtures with the emitted result shape.
Comment thread src/daemon/protocol.ts
Comment thread src/snapshot-tests/__fixtures__/cli/text/macos/launch--success.txt
Comment thread src/snapshot-tests/__fixtures__/cli/text/macos/build--success.txt
Comment thread src/snapshot-tests/preflight/simulator-state.ts
Comment thread src/snapshot-tests/__fixtures__/cli/text/device/launch--success.txt Outdated
Comment thread src/utils/test-common.ts Outdated
Comment thread src/utils/workspace-filesystem-lifecycle.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 94d4ae3. Configure here.

Comment thread src/utils/workspace-filesystem-lifecycle.ts
Comment thread src/snapshot-tests/__fixtures__/cli/text/device/test--failure.txt
Comment thread src/utils/test-source.ts
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.

Add explicit build-for-testing action

1 participant