Ios – Running iOS UIAutomation tests from Jenkins

instrumentsiosios-ui-automationjenkinsxcode

For a while now I've been trying to work out how to run UIAutomation tests from Jenkins – every time I run the build, it builds fine, then it runs my instruments command (using the same command as detailed here ( Can Instruments be used using the command line?) and jenkins just hangs, well the whole machine does, and when I look at activity monitor I can see an instruments process using 2gb of memory.

When I set up jenkins, I original ran it as from a hidden user – this presented some challenges with jenkins being a deamon and not being able to access the window server. I then decided to change the jenkins account to a normal user, logged in and ran instruments from the command line – this worked fine.. but still had no luck with running it from jenkins.

I have set the jenkins account as a developer – no admin though

Please let me know if there's anything else that I could try, or if anyone has got this running successful your guidance would be much appreciated – Thanks

Best Solution

Jenkins on OS X is started from a launchd script and will run as "daemon" by default. The thing to do is change the user in the launched script.

First, get Jenkins ready to shutdown (in "Manage Jenkins" in the GUI).

Then unload the job from launchd, like so:

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

Then edit the "UserName" property in the launchd plist, using the user which you want to run jenkins. There's also a GroupName property, which you may want/need to adjust accordingly with your user's group.

Finally, reload Jenkins with:

$ sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

Hope that helps!

Related Question