How do I run iOS tests on a simulator using Codemagic?

Last updated: July 28, 2026

Context

You may want to use Codemagic to automatically run iOS tests on a simulator as part of your CI/CD pipeline — similar to how you would use the Xcode Simulator locally.

Answer

Codemagic supports running iOS tests on a simulator out of the box. Build machines come with multiple Xcode versions and iOS runtimes preinstalled, so no additional simulator setup is required on your end.

You define the test step in your codemagic.yaml file. There are two common approaches:

Option 1: Using the Codemagic CLI helper (xcode-project run-tests)

- name: iOS test
  script: |
    xcode-project run-tests \
      --workspace MyApp.xcworkspace \
      --scheme MyApp \
      --device "iPhone 11"
  test_report: build/ios/test/*.xml

Option 2: Calling xcodebuild directly with a simulator destination

- name: iOS test
  script: |
    xcodebuild \
      -project "$XCODE_PROJECT" \
      -scheme "$XCODE_SCHEME" \
      -sdk iphonesimulator \
      -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=18.0' \
      clean build test \
      CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

For more details, refer to the official documentation: https://docs.codemagic.io/yaml-testing/testing/

Additionally, if you need to interact with your app manually during a build, Codemagic also offers:

  • App Preview — launches a simulator with your app directly in the browser. See App Preview docs.

  • Remote SSH/VNC access — connect directly to the Mac build machine. See SSH/VNC access docs.