Xcode

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

Prerequisites

  • Apple Xcode 4 – or later version
  • Certificates and provisioning profiles – You must install all required developer certificates and provisioning profiles on every machine that Bamboo will use to run your build. See the App Distribution Guide for more information.
  • Bamboo Xcode support plugin –  The latest Xcode plugin installed in your Bamboo server.
  • ios-sim  (optional when building Mac applications) – a command line utility used to launch the iOS Simulator from the command line. If you have homebrew installed, you can install it by running brew install ios-sim. For other installation methods, see the ios-sim website.
  • Cocoapods (optional if you do not have a Podfile in your project) – Cocoapods is the library dependency manager for Mac OS X. In order for Bamboo to install dependencies from your Podfile (if you have created one), Bamboo will need it installed on all systems where the build should run.

Testing iOS applications

To have tests automatically run on the iOS Simulator and reported within Bamboo you must make some changes to your Xcode project's test bundles and add the Xcode build task to your Job within Bamboo.

Configuring your Xcode project automated simulator tests

Without modifications, Apple does not support running unit tests in the simulator using the xcodebuild terminal utility which Bamboo uses to automate builds and tests.

Using ios-sim and a small modification to the RunUnitTests script phase in the test bundle its possible to overcome this limitation.

 

 

Change the content of the script to:

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

Configuring the Xcode task for testing

To configure a Xcode to test an iOS project task:

  1. Navigate to the Tasks configuration tab for the job (this will be the default job if creating a new plan).
  2. Click the name of an existing Xcode task, or click Add Task then Xcode to create a new task.
  3. Complete the following settings:
     
    Task Description
    A description of the task, which is displayed in Bamboo.

    Disable this task
    Check, or clear, to selectively run this task.

    Apple SDK
    The Apple SDK to target during the build.

    Report test results
    Report and store any OCUnit/SenTestKit results run during the build.

    Run tests in iOS simulator
    Provides the RUN_UNIT_TEST_WITH_IOS_SIM variable used in the custom build phase to run the unit tests on the simulator.

     

  4. Click Save.

Updating the available SDKs when Xcode is upgraded

When you upgrade Xcode you may need to update Bamboo with the correct SDK information.

If you use local agents:

  1. Login as an administrator
  2. Go to Administration -> Server Capabilities
  3. Click Detect server capabilities

If you are using remote agents:

  1. Run xcode-build -showsdks from the command line
  2. Login as an administrator
  3. In Administration -> Agents, pick the agent you wish for the new SDK capability to be present on
  4. Click Add Capability and pick Xcode SDK from the Capability Type field
  5. Set a name for the SDK (e.g. OS X 10.9)
  6. Set a SDK label (e.g. macosx10.9)

 

 

Last modified on Feb 5, 2019

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.