2

I'm having troubles while running XCUITests on iPhone and paired apple watch (simulators) simultaneously using terminal. I can do it by hitting "test button" for each of my uitests targets separately, it works just fine, but I need to do it 1 - from command line 2 - simultaneously

However, I am able to run uitests from command line for the same iPhone simulator (that is paired with apple watch simulator) using

xcodebuild -workspace MyApp.xcworkspace -scheme 'MyApp' -destination 'name=iPhone 11' test

It works as expected- launches simulator and run tests The problem is: When I do the same for paired apple watch (it doesn't matter separately or simultaneously with this iPhone) tests for apple watch doesn't launch at all

xcodebuild -workspace MyApp.xcworkspace -scheme 'MyApp WatchKit App' -destination 'name=iPhone 11' test Terminal says that:

The requested device could not be found because no available devices matched the request.

Available destinations for the "WatchTesterApp WatchKit App" scheme:
    { platform:iOS Simulator, id:2B6CA009-BF6B-4437-9E80-18D53EB003BA, OS:14.5, name:iPhone 11 }

But this device is here and listed as available

So, any suggestions? maybe someone had similar issue? I will appreciate any help

zhanch
  • 145
  • 1
  • 8

1 Answers1

1

So, after a long investigation and a long list of possible fixes that resolved nothing, I updated Xcode and tried to run the same command, which didn't work either and only after creating new clean project using new Xcode it finally worked.

I used:

xcodebuild test -workspace WatchTesterAppExample.xcworkspace -scheme 'WatchTesterAppExample WatchKit App' -destination 'platform=WatchOS Simulator,name=Apple Watch Series 7 - 45mm' & 
xcodebuild test -workspace WatchTesterAppExample.xcworkspace -scheme 'WatchTesterAppExample' -destination 'platform=iOS Simulator,name=iPhone 13' 

It worked for me on the simulators, didn't try it on real device yet

Interesting fact: I am still able to see this error in some case, especially when I don't specify platform in the 'destination'

zhanch
  • 145
  • 1
  • 8