Last active
December 12, 2015 03:18
-
-
Save hlung/4705746 to your computer and use it in GitHub Desktop.
A bash script to put in Xcode's "Run Script" build phrase to make xcodebuild able to run logic tests - to make automated testing possible.
It will launch app using ios-sim and set up environment to inject test bundle into application.
Source: http://stackoverflow.com/a/12682617/504494
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A bash script to put in Xcode's "Run Script" build phrase to make xcodebuild able to run logic tests - to make automated testing possible. | |
# It will launch app using ios-sim and set up environment to inject test bundle into application. | |
# Source: http://stackoverflow.com/a/12682617/504494 | |
# Dependencies: | |
# - ios-sim (https://github.com/phonegap/ios-sim) | |
# Usage: | |
# - create a new test target in the project | |
# - go to Edit Scheme... > Build tick "Run" next to your test target | |
# - put this in XCode's Run Script build phrase. | |
# - run: xcodebuild -workspace Fingi.xcworkspace -scheme "Fingi Tests" -sdk iphonesimulator -configuration Debug clean build RUN_UNIT_TEST_WITH_IOS_SIM=YES ONLY_ACTIVE_ARCH=NO | |
# Note: | |
# - $PRODUCT_NAME can't include any space character, no matter how you \ or "" escape it. = = | |
if [ "$RUN_UNIT_TEST_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