【问题标题】:postbuild UIAutomation script not running in jenkinspostbuild UIAutomation 脚本未在詹金斯中运行
【发布时间】:2012-02-06 09:26:03
【问题描述】:

我正在尝试为 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 是否在您的机器上作为服务运行?如果有,使用什么用户来运行服务?
  • 它在 mac 上使用共享帐户,当我们安装软件包时,它没有提供选择位置/用户并将其安装在共享文件夹中的选项。
  • Jenkins 作为守护进程运行,因此不允许连接到窗口服务器。更多信息在这里developer.apple.com/library/mac/#technotes/tn2083/_index.html
  • @ingorichter 将其作为答案发布。

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


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      【解决方案3】:

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

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

      【讨论】:

        【解决方案4】:

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

        另外,我们不得不将构建用户设为Admin,开发者权限不足。

        在此处查看更多信息:

        UIAutomation : Failed to authorize rights with status: -60007

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-09-12
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-01-29
          相关资源
          最近更新 更多