Unable to run tests from command line via xcodebuild on Jenkins

I use the following command to run tests:

xcodebuild test -workspace MyApp.xcworkspace -scheme MyScheme -destination 'platform=iOS Simulator,name=iPhone 6,OS=8.1' 

This works fine locally, however, when I try to do this on Jenkins, it fails with the following error:

xcodebuild test -workspace MyApp.xcworkspace-scheme MyScheme -destination 'platform = iOS Simulator, name = iPhone 6, OS = 8.1'

xcodebuild: error: Cannot find the destination that matches the provided destination specifier: {platform: iOS Simulator, OS: 8.1, name: iPhone 6}

The requested device could not be found because there are no available devices matching the request.

Available Destinations for MyScheme:

Build Shell Run Step Marked as Failure

Finished: FAILURE

So, I launched the Xcode GUI on Jenkins to check if the iPhone 6 sim is present, and it is. Another interesting thing: when I run the same xcodebuild command without specifying the name and OS for the destination on my local, I get a list of all available simulators, for example:

Available destinations for the MyScheme scheme: {platform: iOS Simulator, id: 683233C4-EC2B-48A3-826B-10EF62A875CD, OS: 8.1, name: iPad 2} {platform: iOS Simulator, id: 6358A6F5-2FD0-4377-BD32 -0A2C3329276D, OS: 8.1, name: iPad Air} {platform: iOS Simulator, id: 224533ED-94DA-46CC-B1DB-1781A1C80710, OS: 8.1, name: iPad Retina} {platform: iOS Simulator, id: D114BC7E-A913 -4063-A349-C119BAFC06DA, OS: 8.1, name: iPhone 4s} {platform: iOS Simulator, id: 7AF6D6F4-C6BC-4A47-B83C-3A4B43ABE0DD, OS: 8.1, name: iPhone 5} {platform: iOS Simulator, id : BE82D607-466A-43E5-863D-6A05F217C117, OS: 8.1, name: iPhone 5s} {platform: iOS Simulator, id: 0AFCC9AB-7C59-48C7-9BFB-FBF4865B7A63, OS: 8.1, name: iPhone 6 Plus} {platform : iOS Simulator, id: D183FF05-3023-4FB5-BEA0-290EA881040A, OS: 8.1, name: iPhone 6} {platform: iOS Simulator, id: 26038D BD-791C-421E-99F4-9153CA726A2F, OS: 8.1, name: Resizable iPad} {platform: iOS Simulator, id: 31B2F0AE-3547-4189-A561-CD2088F6C645, OS: 8.1, name: resize iPhone}

But when I do the same on Jenkins, this list is empty.

I use Xcode Version 6.1 (6A1052d) on both local and Jenkins, my circuits are properly distributed, so I can see them in the GUI when I run it on Jenkins. I'm not sure if this is relevant, but I use the plug-in to clean up the workspace, and I delete all the data received before building on Jenkins.

Edit: I found that when I add the target value with generic / I get the correct list of simulators on Jenkins, he still complains that I could not find the simulator to run, although the one I used is included in the list:

xcodebuild test -workspace MyApp.xcworkspace -scheme MyScheme -destination 'generic / platform = iOS Simulator, name = iPhone 6, OS = 8.1'

xcodebuild: error: Cannot find the destination that matches the one provided. Destination qualifier: {platform: iOS Simulator, OS: 8.1, name: iPhone 6}

The requested device could not be found because there are no available devices matching the request.

Available destinations for the MyScheme scheme: {platform: iOS Simulator, id: 20D0A659-A25A-40E1-9C11-FC6ECA004012, OS: 8.1, name: iPad 2} {platform: iOS Simulator, id: 7B5DF104-BE34-415F-8818 -3907B6CB9C63, OS: 8.1, name: iPad Air} {platform: iOS Simulator, id: 2DDF024E-811D-4D93-BD8E-EF34BFC9D8CA, OS: 8.1, name: iPad Retina} {platform: iOS Simulator, id: FFE95D35-B9DD -449E-83D0-50777BF5B783, OS: 8.1, name: iPhone 4s} {platform: iOS Simulator, id: EF5A0D8A-6A1F-492C-B451-8F3B8B5EC5EE, OS: 8.1, name: iPhone 5} {platform: iOS Simulator, id : A1FCF8DA-BD9F-4ABC-8E0A-4B8547362274, OS: 8.1, name: iPhone 5s} {platform: iOS Simulator, id: 1B75E350-7FC8-4407-8116-F3674F3AC187, OS: 8.1, name: iPhone 6 Plus} {platform : iOS Simulator, id: 694CAA87-765D-4FDF-8B27-75E5B537F48E, OS: 8.1, name: iPhone 6} {platform: iOS Simulator, id: FF5588C0-14B5-4303-A2AC- 9ACF63B1852C, OS: 8.1, name: Resizable iPad} {platform: iOS Simulator, id: E402C9C9-97BA-4909-96B3-3D3C7F6CCC3B, OS: 8.1, name: resize iPhone}

Build the Run Shell step of the marked assembly as a failure

Finished: FAILURE

+5
source share
1 answer

It turns out that Jenkins used a user who did not have enough permissions. I realized this when I created another job and tried to sign the archive. By default, Jenkins uses the user "jenkins" to do something like this, but if you use ssh or screen to share the build server with a different user than you are screwed up with. I decided to remove my Denon Jenkins and use JenkinsApp instead .

+1
source

Source: https://habr.com/ru/post/1206622/


All Articles