See this Gist for .app to .ipa.

Jenkins Step 1

#!/bin/bash -l
echo ">>> xctool, build tests"

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

cd src

export DERIVED_DATA_DIR=`mktemp -d`

echo "     DerivedData folder is ${DERIVED_DATA_DIR}"

security unlock-keychain -p ci ~/Library/Keychains/login.keychain
xctool build-tests -workspace ./my-app.xcworkspace -scheme my-appUITests -derivedDataPath ${DERIVED_DATA_DIR}
java -jar ${JENKINS_HOME}/war/WEB-INF/jenkins-cli.jar  -s ${JENKINS_URL} set-build-parameter DERIVED_DATA_DIR "${DERIVED_DATA_DIR}"


Jenkins Step 2

#!/bin/bash -l
echo ">>> Derived Data"

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

echo "     DerivedData folder is ${DERIVED_DATA_DIR}"

find ${DERIVED_DATA_DIR} -name "*.app"


mkdir AWS_BUILD_DIR/my-app
mkdir AWS_BUILD_DIR/my-app/Payload
mkdir AWS_BUILD_DIR/my-appUITests-Runner
mkdir AWS_BUILD_DIR/my-appUITests-Runner/Payload

cp -R ${DERIVED_DATA_DIR}/Build/Products/Debug-iphoneos/               AWS_BUILD_DIR/my-app/Payload
cp -R ${DERIVED_DATA_DIR}/Build/Products/Debug-iphoneos/ AWS_BUILD_DIR/my-appUITests-Runner/Payload

# cp -R /var/folders/5x/kwy9lj794rs_rx98c0gy9fmr0000gn/T/tmp.VFwJCfgD/Build/Products/Debug-iphoneos/ AWS_BUILD_DIR/my-app/Payload
# cp -R /var/folders/5x/kwy9lj794rs_rx98c0gy9fmr0000gn/T/tmp.VFwJCfgD/Build/Products/Debug-iphoneos/ AWS_BUILD_DIR/my-appUITests-Runner/Payload

cd AWS_BUILD_DIR/my-app
/usr/bin/zip -r my-app.ipa Payload

cd ../..

cd AWS_BUILD_DIR/my-appUITests-Runner
/usr/bin/zip -r my-appUITests-Runner.ipa Payload

cd ../..

mv AWS_BUILD_DIR/my-app/my-app.ipa .
mv AWS_BUILD_DIR/my-appUITests-runner/my-appUITests-Runner.ipa .


find . -name "*.ipa"

exit 0

AWS Device Farm can be used for UI testing of iOS apps.

Need to create two apps:

  • APP.ipa
  • APPUITests.ipa

NOTE: Should we also consider Smartphone Test Farm (STF)?

Don’t forget that * XCTest UI & XCTest are quite different. This note pertains to UI testing which is covered by XCTest UI.

This note also outlines the methology used to automate the build and testing using Jenkins and Fastlane.

See Jenkins job AWS_iOS_Upload_and_Run which uploads two pre-build .ipa files, (my-app.ipa & my-appUITests.ipa)

.ipa Location

  • /users/ci/.jenkins/workspace/AWS_iOS_Upload_and_Run/

.ipa Structure

Analysing the two .ipa files (Which are just ZIP files by another name) we see.

Q: The ipa files come from .app files but lack the Swift support libraries, how does AWS handle this?

TODO .ipa / .app analysis

.ipa / .app analysis.

.ipa files are simply ZIP files. Contents as follows:





To generate:

  1. In Xcode, Select “Generic iOS Device” as the build target
  2. Click Product > Build For > Testing
  3. Open the XCode Derived Data folder for the project, go to Build > Intermediates > Debug-iphoneos.
    This contains 2 files: and
  4. Create a new directory called “Payload” on desktop
  5. Copy the file into the Payload directory
  6. Right click Payload and select “Compress ‘Payload’”
  7. Rename the generated file to mytestapp-uitests.ipa

However, .app files are actually folders which are managed as a single entity by macOS. So looking further, we have - TBS.

Createing an is pretty easy, we can even download from HockeyApp, is less so. When a Fastlane scan is run, it uses the xcode simulator, which creates a ‘x86’ architecture program, not ‘ARM’.

And from Stack overflow we have Building XCTest UI tests for AWS Device Farm.


  • Derived Data -> ~/Library/Developer/Xcode/DerivedData/

The issue is in building

If we look at iOS-DevelopUITest we’ll see that the -Runner App is built in tandom with the main app.

Need to make this happen for ARM targets, not just x86.

TODO: Watch this YouTube video.