Execute tests from the command line with Xcode tools
Xcode
toolsFollow 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.- 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:VariableValueXCODE_PROJ_PATHThe path to your project.APP_SCHEMEThe name of your app scheme.SDK_TYPEiphoneosoriphonesimulator.BUILD_TYPEReleaseorDebug.TEAM_IDThe unique identifier of the team used for signing, as provided by anAppledeveloper program.CODE_SIGNiPhone DistributionoriPhone Developer.FRAMEWORKS_PATHThe path to the folder containing the GD.framework package. The typical value is<Dynamics_SDK_home_folder>/Frameworks.HEADERS_PATHThe path to the ATSL headers. This does not need to be specified if the ATSL is copied within the project folder.DESTINATIONA string that describes the device that will be used to run the tests.For a physical device, it would beplatform=iOS,name=${DEVICE_NAME}, where DEVICE_NAME is the name of the device as returned byinstruments -s devices.For a simulator, it would beplatform=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 byinstruments -s devices.APP_TARGETThe target for user interface tests.CLASSThe test class to be executed. This value is optional. If it is omitted, all test classes in the target are executed.TESTCASEThe 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.