Skip to content

[Feature]: Support TEST_RUNNER_ prefixed env vars #101

@eastlondoner

Description

@eastlondoner

Feature Description

If I have my MCP server set up with a TEST_RUNNER_ prefixed env var it should be passed through to xcodebuild test commands as an env var.

TEST_RUNNER_ prefix is documented here:
https://developer.apple.com/documentation/xcode/environment-variable-reference

Using this example MCP config

{
  "mcpServers": {
    "XcodeBuildMCP": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "xcodebuildmcp@latest"],
      "env": {
        "TEST_RUNNER_USE_DEV_MODE": "YES"
      }
    }
  }
}

Then I should be able to run a UI test like this:

  func testFoo() throws {
    // Check configuration requirement
    let useDevMode = ProcessInfo.processInfo.environment["runsForEachTargetApplicationUIConfiguration"] == "YES"
    guard useDevMode else {
      XCTFail("Test requires USE_DEV_MODE to be true")
      return
    }

Alternatively the test tools should have a parameter for setting env vars.

Use Cases

This allows me to conditionally disable the runsForEachTargetApplicationUIConfiguration property to speed up dev tests.

Example Interactions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions