Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins hangs when running Xcode Unit Tests

I am attempting to run my Xcode unit tests using Jenkins. I can run them from Terminal on my build server using this command with out any issues:

xcodebuild test -scheme MyProject -destination OS=7.0,name="iPad"
CONFIGURATION_BUILD_DIR=/Users/dev/Jenkins/Home/workspace/MyProject/build

However when I try to add that command to my build script (buildscript.sh) file, it hangs when running the unit tests. I also tried adding a new Xcode task to Jenkins and running with these parameters:

XcodeSchema File: MyProject

Configuration: Debug

Custom xcode build arguments: test -destination OS=7.0,name="iPad" CONFIGURATION_BUILD_DIR=/Users/dev/Jenkins/Home/workspace/MyProject/build

It is hanging on a build file in the debug-iphone simulator folder.

** BUILD SUCCEEDED **


setenv SYSTEM_DEVELOPER_DIR /Applications/Xcode.app/Contents/Developer
.
.
.
/bin/sh -c /Users/dev/Library/Developer/Xcode/DerivedData/MyProject
-ggdmamhydtxxzadkbjuusdjmholn/Build/Intermediates/MyProject.build/Debug
-iphonesimulator/MyProjectApplicationTests.build

I took a look at the build file and the environment variable it is using is set correctly.

MyProjectApplicationTest.build

#!/bin/sh
# Run the unit tests in this test bundle.
"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
# "${SYSTEM_DEVELOPER_DIR}/Tools/RunPlatformUnitTests"
# "${PROJECT_DIR}/XcodeScripts/RunPlatformUnitTests

The RunUnitTests file exists in that directory.

I don't know if Jenkins is having issues running the simulator. I spent most of the day yesterday racking my brain on this. If anyone has any ideas on what the issue may be, please let me know.

like image 694
tomg101 Avatar asked Feb 25 '14 17:02

tomg101


1 Answers

I was also facing the same problem and found that jenkins user is not correctly set up to run test case on simulator. Follow instruction given on below website:

https://content.pivotal.io/blog/ios-ci-with-jenkins

see the section "SETTING UP THE JENKINS USER".

hope it will work for you as well.

like image 108
Prateek Jaiswal Avatar answered Nov 19 '22 18:11

Prateek Jaiswal