Skip to main content

Xcodebuild for Unit and UI Testing

This step allows you to run unit and UI tests in your project. When this step runs, all your tests are run, and an .xcresult file is created as a result. This step does not build your app, but uses the xcodebuild command to run tests.

caution

This step does not generate IPA, it only runs tests within the project.

Prerequisites

Prerequisite Workflow StepDescription
Git CloneThe repository must be cloned to initiate the unit and UI testing process. Following the clone, this step will run the tests and create the AC_REPOSITORY_DIR variable.
Xcode SelectThis step selects the specified Xcode version.
danger

If any tests fail during this step, an error will be automatically reported, which reflects issues within the project's tests, not the Appcircle workflow. To prevent disruption in the workflow, enable the "Continue with the next step even if this step fails" option.

Input Variables

Below are the parameters required for this step, along with detailed explanations.

Variable NameDescriptionStatus
$AC_REPOSITORY_DIRSpecifies the cloned repository directory. This path will be generated after the Git Clone step.Required
$AC_OUTPUT_DIR_PATHSpecifies the path for outputs for generated artifacts.Required
$AC_SCHEMESpecifies the project scheme for build. If you filled in Config => Build Schema in the Configuration, this variable comes from Configuration.Required
$AC_ARCHIVE_FLAGSSpecifies the extra xcodebuild flag. For example: -quietOptional
$AC_PROJECT_PATHSpecifies the project path. For example: ./appcircle.xcodeproj. This variable comes from Configuration.Optional
$AC_CONFIGURATION_NAMEYou can build your project with any configuration you want. Specify the configuration as hard-coded. Appcircle will automatically add this configuration to the xcodebuild command. For example; DebugOptional
$AC_COMPILER_INDEX_STORE_ENABLEYou can disable indexing during the build for a faster build. The default value is No.Required
$AC_TEST_OS_VERSIONSpecify the test OS version. The default value is latest. User can use different OS version. For example: 16.3Required
$AC_TEST_DEVICEDestination name of the test simulator device. Ex. iPhone 14. If you set a simulator name, the build will be installed into the given simulator. The default value is iPhone 8 Plus.Required
$AC_TEST_PLATFORMSpecify the test platform. The default value is iOS Simulator.Required
caution

Ensure the simulator type matches the OS version used. For example, if you use the latest OS version, the iPhone 14 simulator cannot be used.

caution

To view the output artifacts on the Download Artifacts page, please ensure that the Export Build Artifacts step is included in your Workflow after this step.

Output Variables

Variable NameDescription
$AC_TEST_RESULT_PATHThe output path for the .xcresult file. This environment variable can be utilized in subsequent steps.