简体   繁体   中英

Starting the simulator in XCode 9 (not headless)

I am trying to run both my unit and ui tests with xcodebuild like:

$ xcodebuild -scheme "MyAppScheme" -destination 'platform=iOS Simulator,name=iPhone 7 Plus,OS=11.0' build test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

The problem is that the simulator doesn't start but instead is running heedlessly.

I am aware of the so called "headless simulator" introduced in XCode 9. Any ideas of how to run the tests with xcodebuild and launch the emulator ?

As far as I know there are no options to allow you to run the tests on a not headless Simulator.

However if a Simulator is already launched the tests will run on that Simulator instead of a headless one. So you can first launch the Simulator and then run the tests:

$ open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app && xcodebuild -scheme "MyAppScheme" -destination 'platform=iOS Simulator,name=iPhone 7 Plus,OS=11.0' build test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM