Skip to content

Instantly share code, notes, and snippets.

@mbinna
Last active October 25, 2017 12:59
Show Gist options
  • Save mbinna/4492087 to your computer and use it in GitHub Desktop.
Save mbinna/4492087 to your computer and use it in GitHub Desktop.
Run Xcode Application Tests from the command line
#!/bin/sh
# Launch application using ios-sim and set up environment to inject test bundle into application
# Source: http://stackoverflow.com/a/12682617/504494
if [ "$RUN_APPLICATION_TESTS_WITH_IOS_SIM" = "YES" ]; then
test_bundle_path="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.$WRAPPER_EXTENSION"
environment_args="--setenv DYLD_INSERT_LIBRARIES=/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection --setenv XCInjectBundle=$test_bundle_path --setenv XCInjectBundleInto=$TEST_HOST"
ios-sim launch $(dirname $TEST_HOST) $environment_args --args -SenTest All $test_bundle_path
echo "Finished running tests with ios-sim"
else
"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment