

$ xcodebuild test-without-building -xctestrun iOSApp_iphonesimulator.xctestrun -destination 'platform=iOS Simulator,id=6DC4A7BA-EA7F-40D6-A327-A0A9DF82F7F6' _TESTROOT_/Debug-iphonesimulator/iOSApp.app Listing 15 Tests the iOS scheme on an iPad Pro (12.9 inch) with iOS 10.2 in the Simulator. The name and id keys are intergeably used with platform, which is a required key as shown in Listing 15 and Listing 16. The version of iOS or tvOS to simulate such as 9.0 or the string latest to indicate the most recent version of iOS supported by your version of Xcode. See Locate a device identifier for more information about getting your device identifier.

The identifier of your device to be used for your unit tests. The name of your device as displayed in the Devices Organizer in Xcode. The full name of the simulator (iOS simulator for iOS apps and tvOS Simulator for tvOS apps) to be used for your unit tests and as displayed in the run destination of your Xcode project. The supported destination for your unit tests. Table 3 Supported keys for iOS Simulator and tvOS Simulator apps. Listing 13 Do not test iOSAppUITests on an iPhone. Test Suite 'iOSAppUITests.xctest' started at. Test Suite 'iOSAppTests.xctest' started at. = BUILD TARGET iOSAppUITests OF PROJECT iOSApp WITH CONFIGURATION Debug = = BUILD TARGET iOSAppTests OF PROJECT iOSApp WITH CONFIGURATION Debug = = BUILD TARGET iOSApp OF PROJECT iOSApp WITH CONFIGURATION Debug = $ xcodebuild test -workspace MyApplication.xcworkspace -scheme iOSApp -destination 'platform=iOS,name=iPhone' They take an argument, which specifies the test to be executed or excluded. The -only-testing and -skip-testing options, which are optional, allow you to run only a specific test and to skip a test, respectively.


It consists of a set of comma-separated key=value pairs, which are dependent upon the the device, simulator, or Mac being used. It takes an argument, which describes the device, simulator, or Mac to use as a destination. The -destination option allows you to specify a destination for your unit tests. It is required when there are multiple Xcode projects in the same directory and optional, otherwise. Use this option when your scheme is contained in an Xcode project. The -project option allows you to specify the name of your Xcode project. Use this option when your scheme is contained in an Xcode workspace. The -workspace option allows you to specify the name of your workspace. See How do I implement the Build For Testing and Test Without Building features from the command line? for more information about build-for-testing and test-without-building actions. The test action requires specifying a scheme and a destination. Xcodebuild test-without-building -xctestrun.
