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.
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}
|
Variable |
Value |
|---|---|
|
XCODE_PROJ_PATH |
The path to your project. |
|
APP_SCHEME |
The name of your app scheme. |
|
SDK_TYPE |
|
|
BUILD_TYPE |
|
|
TEAM_ID |
The unique identifier of the team used for signing, as provided by an Apple developer program. |
|
CODE_SIGN |
|
|
FRAMEWORKS_PATH |
The path to the folder containing the GD.framework package. The typical value is |
|
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 For a simulator, it would be |
|
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.