postbuild UIAutomation 脚本未在 jenkins 中运行

发布于 2025-01-03 00:38:32 字数 1218 浏览 3 评论 0原文

我正在尝试为 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 程序

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

I am trying to do End-to-End automation for an iOS project. My aim is to automate the continuous integration process with attaching UIAutomation scripts as post build action.
So from the time when a user do check his code in SVN and till we get test result of automation, everything will be automated.

Jenkins is installed on my local machine and running on localhost.
Now I have automated build process through jenkins and at other end I have my shell script ready which will run UIAutomation java scripts on build output.
When I use my shell script as post build action then I get error in running instrument command(written inside shell script) but if I run this script manually through terminal then it works fine.

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

then i tried this command with sudo then I got following error
sudo: no tty present and no askpass program specified

Please let me know how can I run these commands successful, only this step is left in my task.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

秋叶绚丽 2025-01-10 00:38:32

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

Jenkins by default installs as a LaunchDaemon, which means it has insufficient permissions to launch WindowsServer.

You’ll need to configure it as a LaunchAgent:

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

Then login as Jenkins and keep a session open.

If you don't know the Jenkins password you can change it with:

sudo passwd jenkins
秋千易 2025-01-10 00:38:32

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

Jenkins is running as a daemon and is therefore not allowed to connect to the window server. More info here http://developer.apple.com/library/mac/#technotes/tn2083/_index.html.

雅心素梦 2025-01-10 00:38:32

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

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

Sorry - not got time to put a complete answer now, will update later....

This is possible if you run jenkins as a user app rather than as a deamon -- this might come in handy (https://github.com/stisti/jenkins-app) I haven't tried it but looks like it should work -- I went down another route setting up an always logged in user, that ran jenkins from a login script, it did mean I had to re-install jenkins but managed to get it up and running... word of warning from someone thats been through it, are you using instruments for automated testing? If so, you'll need to do some transformation on the output so it displays in Jenkins.

oО清风挽发oО 2025-01-10 00:38:32

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

另外,我们必须将构建用户设置为管理员,开发人员权限不足。

在此处查看更多信息:

UIAutomation:无法授权权限,状态:-60007

We have a Jenkins Linux instance that builds to a Mac slave over SSH. One interesting requirement that we noticed with this error is that the build user on the slave must be logged into the console in order for everything to work correctly.

In addition, we had to make the build user an Admin, developer permissions were insufficient.

See more info here:

UIAutomation : Failed to authorize rights with status: -60007

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文