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:
我正在尝试使用Jenkins运行我的Xcode单元测试。我可以使用这个命令从我的构建服务器上的终端运行它们,不存在任何问题:
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:
但是,当我尝试将该命令添加到我的构建脚本(buildscript.sh)文件时,它在运行单元测试时挂起。我还尝试向Jenkins添加一个新的Xcode任务,并使用以下参数运行:
XcodeSchema File: MyProject
XcodeSchema文件:。
Configuration: Debug
配置:调试
Custom xcode build arguments: test -destination OS=7.0,name="iPad" CONFIGURATION_BUILD_DIR=/Users/dev/Jenkins/Home/workspace/MyProject/build
自定义xcode构建参数: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.
它挂在debug-iphone模拟器文件夹中的构建文件上。
** 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
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.
RunUnitTests文件存在于该目录中。
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.
我不知道詹金斯是否有运行模拟器的问题。我昨天大部分时间都在思考这个问题。如果有人对这个问题有什么想法,请告诉我。
1 个解决方案
#1
2
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:
我也遇到了同样的问题,发现jenkins用户在模拟器上运行测试用例的设置不正确。按照以下网站的指示:
https://content.pivotal.io/blog/ios-ci-with-jenkins
https://content.pivotal.io/blog/ios-ci-with-jenkins
see the section "SETTING UP THE JENKINS USER".
请参阅“设置JENKINS用户”一节。
hope it will work for you as well.
希望它对你也有帮助。
#1
2
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:
我也遇到了同样的问题,发现jenkins用户在模拟器上运行测试用例的设置不正确。按照以下网站的指示:
https://content.pivotal.io/blog/ios-ci-with-jenkins
https://content.pivotal.io/blog/ios-ci-with-jenkins
see the section "SETTING UP THE JENKINS USER".
请参阅“设置JENKINS用户”一节。
hope it will work for you as well.
希望它对你也有帮助。