xcode 从 Jenkins 运行 iOS UIAutomation 测试
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10420324/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Running iOS UIAutomation tests from Jenkins
提问by ChrisH
For a while now I've been trying to work out how to run UIAutomation tests from Jenkins - every time I run the build, it builds fine, then it runs my instruments command (using the same command as detailed here ( Can Instruments be used using the command line?) and jenkins just hangs, well the whole machine does, and when I look at activity monitor I can see an instruments process using 2gb of memory.
一段时间以来,我一直在尝试研究如何从 Jenkins 运行 UIAutomation 测试 - 每次我运行构建时,它都能正常构建,然后运行我的仪器命令(使用此处详述的相同命令(可以使用仪器吗)使用命令行?)并且 jenkins 只是挂起,整个机器都这样,当我查看活动监视器时,我可以看到一个使用 2GB 内存的仪器进程。
When I set up jenkins, I original ran it as from a hidden user - this presented some challenges with jenkins being a deamon and not being able to access the window server. I then decided to change the jenkins account to a normal user, logged in and ran instruments from the command line - this worked fine.. but still had no luck with running it from jenkins.
当我设置 jenkins 时,我最初以隐藏用户的身份运行它 - 这给 jenkins 带来了一些挑战,因为 jenkins 是一个守护进程并且无法访问窗口服务器。然后我决定将 jenkins 帐户更改为普通用户,登录并从命令行运行仪器 - 这工作正常..但仍然没有从 jenkins 运行它的运气。
I have set the jenkins account as a developer - no admin though
我已将 jenkins 帐户设置为开发人员 - 虽然没有管理员
Please let me know if there's anything else that I could try, or if anyone has got this running successful your guidance would be much appreciated - Thanks
请让我知道是否还有其他我可以尝试的方法,或者如果有人成功运行此程序,将不胜感激您的指导 - 谢谢
采纳答案by malenkiy_scot
So if you run it as a daemon, first thing to check what happens if you run Jenkins in the foreground The simplest way to do it is with java -jar jenkins.war [other options]
command (see this document).
因此,如果您将它作为守护进程运行,首先要检查如果您在前台运行 Jenkins 会发生什么最简单的方法是使用java -jar jenkins.war [other options]
命令(请参阅此文档)。
回答by mvl
Jenkins on OS X is started from a launchd script and will run as "daemon" by default. The thing to do is change the user in the launched script.
OS X 上的 Jenkins 从 launchd 脚本启动,默认情况下将作为“守护进程”运行。要做的是在启动的脚本中更改用户。
First, get Jenkins ready to shutdown (in "Manage Jenkins" in the GUI).
首先,让 Jenkins 准备好关闭(在 GUI 的“管理 Jenkins”中)。
Then unload the job from launchd, like so:
然后从launchd卸载作业,如下所示:
$ sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
Then edit the "UserName" property in the launchd plist, using the user which you want to run jenkins. There's also a GroupName property, which you may want/need to adjust accordingly with your user's group.
然后使用要运行 jenkins 的用户编辑 launchd plist 中的“UserName”属性。还有一个 GroupName 属性,您可能希望/需要根据您的用户组进行相应调整。
Finally, reload Jenkins with:
最后,使用以下命令重新加载 Jenkins:
$ sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
Hope that helps!
希望有帮助!
回答by houlianpi
Maybe you can use this https://github.com/houlianpi/robot4ios.
也许你可以使用这个https://github.com/houlianpi/robot4ios。
Then in jenkins execute shell:
然后在 jenkins 中执行 shell:
sh setup.sh
sh runTests.sh ./sample/alltests.js "/Users/komejun/Library/Application Support/iPhone Simulator/5.0/Applications/1622F505-8C07-47E0-B0F0-3A125A88B329/Recipes.app/"
and the report will be auto create in ./ynmsk-report/test.xml
并且报告将自动创建 ./ynmsk-report/test.xml