postbuild UIAutomation脚本没有在jenkins中运行

时间:2012-02-06 09:26:04

标签: ios macos shell jenkins ios-ui-automation

我正在尝试为 iOS项目执行端到端自动化。我的目标是通过附加UIAutomation脚本作为后期构建操作来自动执行持续集成过程。 因此,当用户在SVN中检查他的代码并且直到我们获得自动化的测试结果时,一切都将自动化。

Jenkins已安装在我的本地计算机上,并在localhost上运行 现在我通过jenkins实现了自动构建过程,另一方面我准备好了shell脚本,它将在构建输出上运行UIAutomation个java脚本。
当我使用我的shell脚本作为后期构建操作时,我在运行instrument命令时遇到错误(在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程序

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

4 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:2)

Jenkins作为守护程序运行,因此不允许连接到窗口服务器。更多信息http://developer.apple.com/library/mac/#technotes/tn2083/_index.html

答案 2 :(得分:1)

抱歉 - 现在没时间给出完整答案,稍后会更新....

如果您将jenkins作为用户应用程序而不是作为deamon运行,这是可能的 - 这可能会派上用场(https://github.com/stisti/jenkins-app)我没有尝试过但看起来应该可以工作 - 我失败了设置一个始终登录用户的另一条路线,从登录脚本运行jenkins,它确实意味着我必须重新安装jenkins但设法启动并运行...来自某人的警告信息,是你使用仪器进行自动化测试?如果是这样,您需要对输出进行一些转换,以便在Jenkins中显示。

答案 3 :(得分:0)

我们有一个通过SSH构建到Mac从站的Jenkins Linux实例。我们注意到这个错误的一个有趣要求是,奴隶上的构建用户必须登录到控制台才能使一切正常工作。

此外,我们必须使构建用户成为管理员,开发人员权限不足。

在此处查看更多信息:

UIAutomation : Failed to authorize rights with status: -60007