postbuild UIAutomation script not running in jenkins
Asked Answered
S

4

13

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.

Sulph answered 6/2, 2012 at 9:26 Comment(4)
Does Jenkins run as a service on your machine? If so, what user is used to run the service?Peirce
it is using shared account on mac, when we install the package it does not give option to select location/user and install it on shared folder.Sulph
Jenkins is running as a daemon and is therefore not allowed to connect to the window server. More info here developer.apple.com/library/mac/#technotes/tn2083/_index.html.Peirce
@Peirce post that as an answer.Emergent
S
3

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
Sabatier answered 9/1, 2014 at 18:24 Comment(0)
P
2

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.

Peirce answered 4/4, 2012 at 16:43 Comment(0)
R
1

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.

Raybourne answered 6/2, 2013 at 13:10 Comment(0)
P
0

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

Polytrophic answered 26/2, 2013 at 13:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.