Xcode 4.5 command line unit testing

Just thought I should also share what I did for a solution to this issue. I followed the solution outlined in https://stackoverflow.com/a/10823483/666943 but converted the ruby script to shell. At the end I basically installed ios-sim via homebrew and replace the Run Script in the Build Phases of my Test target with the following:

if [ "$RUN_UNIT_TEST_WITH_IOS_SIM" = "YES" ]; then
    test_bundle_path="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.$WRAPPER_EXTENSION"
    ios-sim launch "$(dirname "$TEST_HOST")" --setenv DYLD_INSERT_LIBRARIES=/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection --setenv XCInjectBundle="$test_bundle_path" --setenv XCInjectBundleInto="$TEST_HOST" --args -SenTest All "$test_bundle_path"
    echo "Finished running tests with ios-sim"
else
    "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
fi

To start the test now I pass in the argument RUN_UNIT_TEST_WITH_IOS_SIM=YES e.g.

xcodebuild -workspace MyApp.xcworkspace -scheme MyAppTests -sdk iphonesimulator -configuration Debug clean build RUN_UNIT_TEST_WITH_IOS_SIM=YES

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)