ios – postbuild UIAutomation脚本不在jenkins中运行

我正在努力为iOS项目做端对端自动化.我的目标是通过将UIAutomation脚本作为后期构建操作来自动化持续集成过程.
所以从用户在SVN中检查他的代码,直到我们获得自动化的测试结果,一切都将自动化.

Jenkins安装在本地机器上,并在localhost上运行.
现在我通过jenkins自动构建过程,另一端我有我的shell脚本,这将在构建输出上运行UIAutomation java脚本.
当我使用我的shell脚本作为后期构建操作时,我得到运行仪器命令(在shell脚本中写入)的错误,但是如果我通过终端手动运行这个脚本,那么它工作正常.

instruments[64703:60f] -[NSAlert alertWithError:] called with nil NSError. A generic error message will be displayed,but the user deserves better.
_RegisterApplication(),FAILED TO establish the default connection to the WindowServer,_CGSDefaultConnection() is NULL. Mon Feb  6 13:15:20 inpunml310743 instruments[64703] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged. 2012-02-06 13:15:20.179 instruments[64703:60f] Recording cancelled : At least one target failed to launch; aborting run Instruments Trace Error : Failed to start trace. Build step 'Execute shell' marked build as failure Finished: FAILURE

然后我用sudo尝试这个命令,然后我得到以下错误
sudo:没有tty礼物,没有指定任何askpass程序

请让我知道如何运行这些命令成功,只有这一步留在我的任务中.

解决方法

Jenkins默认安装为LaunchDaemon,这意味着它没有足够的权限启动WindowsServer.

您需要将其配置为LaunchAgent:

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
sudo mv /Library/LaunchDaemons/org.jenkins-ci.plist /Library/LaunchAgents/org.jenkins-ci.plist

然后登录为Jenkins并保持会话打开.

如果您不知道Jenkins密码,您可以通过以下方式更改密码:

sudo passwd jenkins

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...