Skip to main content

Building XCUITest

To test with XCUITest on TestingBot, you will need to build and export the XCUITests you have created.
If you do not have a zip file of the XCUITest suite, you can follow the examples below.

The zip file should contain a folder similar to this:

xcuitest-sampleUITests-Runner.app

Code signing is not required. TestingBot re-signs the app and the test runner for its own devices before installing them, so you do not need a provisioning profile that includes TestingBot's devices. You can build without signing (CODE_SIGNING_ALLOWED=NO), which also means your CI machine does not need your certificates. Build for a device (Debug-iphoneos), not for the simulator: XCUITest runs on real devices on TestingBot.

Using XCode (13 and higher)

  1. From the XCode schemes dropdown menu, select your app scheme and Any iOS Device as device
  2. Click Product -> Clean (Cmd+Shift+K)
  3. Click Product -> Build For -> Testing (Cmd+Shift+U)
  4. Go to Product -> Show Build Folder in Finder
  5. In Finder, navigate to Products -> Debug-iphoneos. The directory should contain a file that ends with -Runner.app.
    Right click and choose the compress option to generate a zip file.

Using XCode (Lower than 13.0)

  1. From the XCode schemes dropdown menu, select your app scheme and Generic iOS device as device
  2. Click Product -> Clean (Cmd+Shift+K)
  3. Click Product -> Build For -> Testing (Cmd+Shift+U)
  4. Right click the .app file using the Project Navigator, and select Show in Finder
  5. In Finder, the directory should contain a file called <AppnameUITests>-Runner.app.
    Right click and choose the compress option to generate a zip file.

Using Command Line

To build the .zip file from the command line, please follow these steps:

  1. Change to the project directory and build for testing:
    xcodebuild build-for-testing \
      -scheme <scheme-name> \
      -destination 'generic/platform=iOS' \
      -derivedDataPath build \
      CODE_SIGNING_ALLOWED=NO

    CODE_SIGNING_ALLOWED=NO is optional: TestingBot re-signs the build, so an unsigned build works.

  2. Go to the products folder for devices, build/Build/Products/Debug-iphoneos (with -derivedDataPath build as above; otherwise it is inside Xcode's DerivedData directory, see Settings -> Locations).
  3. Zip the test runner, and package the app as an .ipa (a zip with the app inside a Payload folder):
    cd build/Build/Products/Debug-iphoneos
    zip --symlinks -r <MyAppUITests>.zip <AppnameUITests>-Runner.app
    mkdir Payload
    cp -R <Appname>.app Payload/
    zip -r <Appname>.ipa Payload
    rm -rf Payload
Was this page helpful?
Last updated