I am facing a strange issue:
I am trying to build using this xcode command
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id={deviceID}' test
But every time I run this command I see an unusual prompt that shows up in the next line --
quote]
I am not sure what quote means and what I am expected to enter. I tried entering other device attributes but still it din help me .
Could some one please help me?
As far as I understand your provided information you are trying to start a test on a real device. Tests are executed on simulator only, which is why Xcode tells you it's not able to build your project.
Try something like this instead:
xcodebuild \
-project WebDriverAgent.xcodeproj \
-scheme WebDriverAgentRunner \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 6,OS=8.1' \
test
As you can see this command tries to build your project on an iPhone 6 simulator with iOS 8.1 installed. You can define this to your liking (e.g. OS=13.0 or another iPhone/iPad).
You can give these reads a try, too, for more examples and a better understanding:
https://www.mokacoding.com/blog/running-tests-from-the-terminal/
https://www.appsdeveloperblog.com/run-xcode-unit-tests-from-the-command-line/
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 have the following goal to achieve: build and run an .app application using xcodebuild and ios-sim.
I'm using the following script to build the application.
xcrun xcodebuild \
-scheme $XCODE_SCHEME \
-project $XCODE_PROJECT \
-configuration Debug \
-destination generic/platform=iOS \
-derivedDataPath \
build
Then for running it, I'm using
ios-sim launch MyApp.app/ --devicetypeid "iPhone-6-Plus, 9.1"
Each time I receive the following message:
Program specified by service does not contain one of the requested
architectures: ?
What is happening, that the app doesn't run?
Note: if I run the second command (ios-sim...) against the .app built from Xcode (the one contained in derived data) the procedure works fine.
Ok. Figured out the issue.
You need to specify the correct destination. For example.
xcrun xcodebuild \
-scheme $XCODE_SCHEME \
-project $XCODE_PROJECT \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 6 Plus,OS=9.1' \
-derivedDataPath \
build
In this way Xcode will create the folder (called build) containing your products (in particular look at Debug-iphonesimulator). The build dir is created within the dir you are running the xcodebuild command.
Now you can point that folder in order to run the ios-sim command (see ios-sim for more references) or simctl (see iOS 8: Building custom simulators and Build And Run iOS Apps In Commmand Line for more info).
I am running the following command from command line to build/test my workspace. The idea is to port it eventually to a CI system. But what happens is that one of the runs succeed but all of the following ones fail. They fail in an odd manner in that the build completes as part of the command but then, I see the message which kicks off the simulator and I see the simulator up but the tests are never run on it. The command is either hung on it forever or it fails with no error message. I tried using xcrun simctl erase all before the command to make sure the simulator is clean. I also tried avoiding specifying derivedDatapath and OBJROOT hoping that would make the builds clean but so far, I am stuck here.
xcodebuild test -workspace <workspace-name> -scheme <scheme-name> -configuration Coverage -sdk iphonesimulator -destination platform='iOS Simulator',OS=9.0,name='iPhone 6'
The final error I see is /usr/bin/touch -c /home-folder/Library/Developer/Xcode/DerivedData/.../Build/Products/Coverage-iphonesimulator/Tests.xctest ** TEST FAILED **
The code runs smoothly from within XCode and the tests always pass. I believe this is some issue with the terminal app connecting to the simulator or the simulator being in a weird state after an earlier run but I could not figure out what could be causing the problem. Any suggestions would be great.
XCode Version: 7.0.1
I don't know if that is the issue, but shouldn't test be at the end of the line? Like this:
xcodebuild -workspace <workspace-name> -scheme <scheme-name> -configuration Coverage -sdk iphonesimulator -destination platform='iOS Simulator',OS=9.0,name='iPhone 6' test
Thank you for seeing this question.
I wrote unit tests with GHUnit.
Now I am trying build tests on terminal to connect with Travis CI, and facing a problem.
I basically followed
http://gabriel.github.io/gh-unit/docs/appledoc_include/guide_command_line.html
and customize a command little bit.
Here is customized command
GHUNIT_CLI=1 xcodebuild ONLY_ACTIVE_ARCH=NO -target UnitTest -configuration Debug -sdk iphonesimulator build
After that some compile started, but finally I got error below.
The iOS Simulator libSystem was initialized out of order. This is most often caused by running host executables or inserting host dylibs. In the future, this will cause an abort.
If you know the way to solve, please let me know that.
Thank you.
Had the same issue, running it like this
GHUNIT_CLI=1 xcodebuild ONLY_ACTIVE_ARCH=NO -workspace <yourworkspace> -scheme <scheme> -configuration Debug -sdk iphonesimulator build
solved the problem