Skip Navigation

Execute tests from the command line with 
Xcode
 tools

Follow these instructions to build the application and test code, run the tests on a connected 
iOS
 device or simulator, and record the results. You can run the command from a continuous integration system such as Jenkins.
  1. Run the following command:
    xcodebuild test -project "${XCODE_PROJ_PATH}" -scheme "${APP_SCHEME}" \ -sdk "${SDK_TYPE}" -configuration "${BUILD_TYPE}" \ CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES=YES \ DEVELOPMENT_TEAM="${TEAM_ID}" CODE_SIGN_IDENTITY="${CODE_SIGN}" \ FRAMEWORK_SEARCH_PATHS="${FRAMEWORKS_PATH}" \ HEADER_SEARCH_PATHS="${HEADERS_PATH}" \ -destination "${DESTINATION}" \ -only-testing:${APP_TARGET}/${CLASS}/${TESTCASE}
    Define the following variables:
    Variable 
    Value 
    XCODE_PROJ_PATH
    The path to your project. 
    APP_SCHEME 
    The name of your app scheme. 
    SDK_TYPE 
    iphoneos
     or 
    iphonesimulator
    BUILD_TYPE 
    Release
     or 
    Debug
    TEAM_ID 
    The unique identifier of the team used for signing, as provided by an 
    Apple
     developer program. 
    CODE_SIGN 
    iPhone Distribution
     or 
    iPhone Developer
    FRAMEWORKS_PATH 
    The path to the folder containing the GD.framework package. The typical value is 
    <Dynamics_SDK_home_folder>/Frameworks
    HEADERS_PATH 
    The path to the ATSL headers. This does not need to be specified if the ATSL is copied within the project folder. 
    DESTINATION 
    A string that describes the device that will be used to run the tests.
    For a physical device, it would be 
    platform=iOS,name=${DEVICE_NAME}
    , where DEVICE_NAME is the name of the device as returned by 
    instruments -s devices
    For a simulator, it would be 
    platform=iOS Simulator,name=${SIMULATOR_NAME},OS=${IOS_VERSION}
    , where IOS_VERSION is the version (for example, 10.3) and SIMULATOR_NAME is the name of the hardware simulator as returned by 
    instruments -s devices
    APP_TARGET 
    The target for user interface tests. 
    CLASS 
    The test class to be executed. This value is optional. If it is omitted, all test classes in the target are executed. 
    TESTCASE
    The method within the test class to be run. This value is optional. If it is omitted, all test methods in the class are run.
Test results are printed on standard output in the OCUnit format, and can be saved by a continuous integration system. You might need to convert the format to JUnit or another format that is suitable for your continuous integration system.