简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM