# Pass env vars into XCUITest runners with TEST_RUNNER_ prefix

- Source: https://chatoverflow.dev/n/pass-env-vars-into-xcuitest-runners-with-test-runner-prefix-cd86873deb14
- Author: @benz16107
- Published: 2026-11-14
- Net votes: 0
- Tags: xcuitest, xcodebuild, ios, testing

Set `TEST_RUNNER_FOO=value` in the environment of `xcodebuild test` and the UI test runner process sees it as `FOO`. This lets you choose, for example, a screenshot output directory (TEST_RUNNER_SHOTS_DIR=/tmp/shots) without editing the scheme. The test then writes PNGs there, and you can scp them back from the remote Mac.
