I'm trying to launch an iOS app tests through command line, from a Jenkins Job.
If I launch the command in my user's console, works ok, the command is:
xcodebuild test -scheme demoIC -destination 'platform=iOS Simulator,id=E6954360-11D9-49E0-9008-A8EE6BA1ACFC'
It's supposed Jenkins uses 'jenkins' user for launching jobs, so I have done:
su - jenkins
And the when I launch the same command, I got an error:
2015-02-16 18:21:41.215 xcodebuild[3952:1303] iPhoneSimulator: Could not launch simulator: -10810
You can give a try to this, it worked for me:
xcrun xcodebuild -workspace $Project_Name.xcworkspace -scheme "$Build_Test_Scheme" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 8,OS=13.2.2' -derivedDataPath './output' test
Related
When I run my UITest from XCode they all pass correctly but when I use xcodebuild - some of them fail with error:
Failure: UITestBase.swift:63: Failed to get matching snapshot: Lost connection to the application (pid 43193).
Currently I'm using 11.6, it did work fine on Xcode 10.x, xcodebuild points to correct Xcode where tests pass from IDE
xcodebuild command that I'm using:
xcodebuild clean test -workspace APP.xcworkspace -scheme APPUITests -configuration Release OTHER_SWIFT_FLAGS="-DCOCOAPODS -DAPPProdTarget" -destination "platform=iOS Simulator,name=iPhone 11,OS=13.6"
I am trying to automate real ios device with Appium on OS X Catalina.
Here is the error I get:
Appium Doctor confirmed all required components are installed
successfully. "WebDriverAgent.xcodeproj" (path
"/Applications/Appium.app/Contents/Resources/app/node_modules/appium-webdriveragent)successfully
build on xcode (11.4.1) & able to install/run/open the
"IntregrationApp" on iphone xr.
However When running "xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=udid' test" in the terminal, I am getting this error:
xcodebuild
-project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=udid' test"
"Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=xxxxxxxxxxxxxx test xcodebuild: error: 'WebDriverAgent.xcodeproj' does not exist.
Confirm your path where you run this command
if you install appium through command line then verify pwd as
/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent
then run above command
I try to compile my app for UITesting and in a second time run the UITest on iOS simulator. But I need to do this in 2 times.
In one time I use :
xcodebuild -workspace './MyApp.xcworkspace' -scheme 'MyScheme' -derivedDataPath '~/Documents/derived_data/' -destination 'platform=iOS Simulator,id=6EE927C0-FC0E-4235-8915-3BFF1F128B76,OS=9.2' build test | xcpretty
Any Idea how to copy and launch MyApp.app, MyAppUITests-Runner.app in the simulator?
Thanks.
Alak
Edit:
Anyway to launch something like :
xcrun simctl launch "UITest"
and get xcactivitylog from this ?
try this:
xcodebuild -workspace App.xcworkspace -scheme "App-Scheme" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.1' test
it will compile the App and run the UI Test in the simulator.
I am running test using xctool, and I would like to be able to choose the simulator. I am using the following line:
xctool -workspace MyProject.xcworkspace -scheme MyProject test -reporter junit:test-results.xml -reporter teamcity -sdk iphonesimulator
However, the simulator that is open is the iPhone 4s simulator. Does anybody knows how to select the iPhone 6 simulator.
Using the -destination flag you can select a specific device to be run for your simulator :
-destination platform='iOS Simulator',OS=8.4,name='iPhone 6'
You should try the following command (replacing MyProject by the name of your project):
xctool -workspace MyProject.xcworkspace -scheme MyProject test -reporter junit:test-results.xml -reporter teamcity -sdk iphonesimulator -destination platform='iOS Simulator',OS=8.4,name='iPhone 6'
I normally run my xcode unit tests on command line using these commands:
clean:
xcodebuild -workspace appName.xcworkspace -scheme "Shared appName" -destination "platform=iOS Simulator,name=iPhone 5s,OS=8.1" clean
then build:
xcodebuild -workspace appName.xcworkspace -scheme "Shared appName" -destination "platform=iOS Simulator,name=iPhone 5s,OS=8.1" build
then test (with dry run):
xcodebuild -workspace appName.xcworkspace -scheme "Shared appName" -destination "platform=iOS Simulator,name=iPhone 5s,OS=8.1" test -dry-run
and I sometimes I get this error:
2015-02-27 11:01:50.417 Registering for testmanagerd availability notify post.
2015-02-27 11:01:50.417 testmanagerd availability notify_get_state check indicated manager not ready, waiting for notify post.
2015-02-27 11:02:50.371 60s elapsed since launch without testing starting, sending logs to stderr
any idea how to prevent this from happening? I'm assuming that the testmanagerd is a test daemon or something? Where can I find documentation about that?
This timeout usually means that your mac is too slow and it took more than expected to run the simulator. You should start thinking in getting a new machine.