Skip to content

Instantly share code, notes, and snippets.

@GrayedFox
Last active May 19, 2022 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GrayedFox/7b079c54e416d8f7ea82c66ea0ce8d9d to your computer and use it in GitHub Desktop.
Save GrayedFox/7b079c54e416d8f7ea82c66ea0ce8d9d to your computer and use it in GitHub Desktop.
AppCenter Post Build Script for running XCUI Tests
#!/bin/sh
# this script assumes you have added an API token via AppCenter and stored it
# as an environment variable in your build configuration settings
# see https://docs.microsoft.com/en-us/appcenter/test-cloud/frameworks/xcuitest/#build-for-testing
# for a better understanding of what's going on
SCHEME="schemeOfApplicationUnderTest"
APP="appleUserName/appName"
DEVICES="appCenterTestDevices"
TEST_SERIES="appCenterTestSeriesName"
LOCALE="en_US"
# Post Build Script run by AppCenter which launches XCUI Tests
if [ "$AGENT_JOBSTATUS" == "Succeeded" ]; then
# build the AUT scheme, removing any old DerivedData first
rm -rf DerivedData
xcrun xcodebuild -allowProvisioningUpdates build-for-testing \
-configuration Debug \
-sdk iphoneos \
-scheme $SCHEME \
-derivedDataPath DerivedData
# submit the test command to AppCenter
appcenter test run xcuitest \
--app $APP \
--devices $DEVICES \
--test-series $TEST_SERIES \
--locale $LOCALE \
--build-dir "$APPCENTER_SOURCE_DIRECTORY/DerivedData/Build/Products/Debug-iphoneos/" \
--token $APPCENTER_TOKEN \
--async
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment