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
Related
I am new to jenkins, I am trying to build my iOS application on simulator via jenkins. I am using this command,
xcrun xcodebuild -project Name.xcodeproj \
-scheme Name \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,OS=15.5,name=iPhone 12' \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \
build
The build is successful but I can't see the application built on my simulator. And How can I build the same app on real device via jenkins?
The command that you are running will build the application FOR the simulator (this usually means that it will build the application for the 64-bit architecture).
That doesn't mean that it will actually copy/install the application to the simulator for you, its literally just building the application with that architecture so that it is compatible with the simulator.
To build for device, replace your destination with -destination generic/platform=iOS you would also need code signing
So, I have a big probleme here. Im working witch Xcode 9 and if I run my Tests inside Xcode, everything works fine! Like this:
Screenshot
But if I want to do it inside my Command Line (because we need it for CD) I get some strange Errors, like some of my modules doesn't exist. So this is my command:
xcodebuild -workspace myapp.xcworkspace/ -scheme GelbeSeiten -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=11.0' test
So what is the difference between the Test inside the Xcode IDE and my command?
I created bunch of XCode7 UI tests that I run for every developer build, I wonder if I can track application memory usage from point when I start tests until all my tests finished so it could be analyzed later?
I start my tests by command-line:
xcodebuild test -scheme "AppSchema" -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6s Plus,OS=9.3'
I am running iOS tests on Circle CI using Xcode 6.4 and iOS 8.4 with this command:
xctool -workspace ios.xcworkspace -scheme ios test -sdk iphonesimulator8.4
But when the simulator runs, it fails to run my tests and I receive this error:
Test did not run: The simulator failed to start, or the TEST_HOST
application failed to run. Simulator error: Exception encountered
connecting to CoreSimulatorBridge: Unable to connect to
CoreSimulatorBridge
Looking at the logs, it looks like the simulator actually tries to run against iOS 9:
run-test iosTests.xctest (iphonesimulator9.0, iPhone 4s, application-test)
Is there a way to force it to run on iOS 8.4 so the tests would run?
I had the same issue recently on Circle CI. I'm not sure if it's related to xctool's newest version (0.2.7) or not, but adding this fixed it for me:
-destination platform='iOS Simulator,OS=8.4,name=iPhone 6'
So the full command in your case should be:
xctool -workspace ios.xcworkspace -scheme ios test -sdk iphonesimulator8.4 -destination platform='iOS Simulator,OS=8.4,name=iPhone 6'
Is there a way to prevent the app from building when I am just unit testing? When I run the test it builds the app and that takes minutes. I have written the tests in Swift and targets ios 8.
In Xcode 8+, you can pass the "test-without-building" option.
$ xcodebuild -workspace <your_xcworkspace> -scheme <your_scheme> -sdk iphonesimulator -destination ‘platform=iOS Simulator,name=<your_simulator>,OS=10.2’ test-without-building
Read more here: https://medium.com/xcblog/speed-up-ios-ci-using-test-without-building-xctestrun-and-fastlane-a982b0060676