7

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

Community
  • 1
  • 1
ChrisH
  • 285
  • 3
  • 13

3 Answers3

4

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!

mvl
  • 789
  • 7
  • 11
  • This worked perfectly for me. By default the GroupName was set to daemon and that was crashing the ios simulator – maschall Oct 28 '12 at 23:06
  • We followed this solution and it worked but one thing to note - It seems in newer versions of xcode you need to remove the SessionCreate and value from your org.jenkins-ci.plist see here for more details: http://www.cimgf.com/2015/05/26/setting-up-jenkins-ci-on-a-mac-2/ – Daveloper87 Aug 03 '15 at 15:59
1

So if you run it as a daemon, first thing to check what happens if you run Jenkins in the foreground The simplest way to do it is with java -jar jenkins.war [other options] command (see this document).

malenkiy_scot
  • 16,415
  • 6
  • 64
  • 87
0

Maybe you can use this https://github.com/houlianpi/robot4ios.

Then in jenkins execute shell:

sh setup.sh
sh runTests.sh ./sample/alltests.js "/Users/komejun/Library/Application Support/iPhone Simulator/5.0/Applications/1622F505-8C07-47E0-B0F0-3A125A88B329/Recipes.app/"

and the report will be auto create in ./ynmsk-report/test.xml

mttrb
  • 8,297
  • 3
  • 35
  • 57
houlianpi
  • 66
  • 3
  • That sounds interesting, will robot4ios manage setup/teardown between tests too? I take it the xml output is compatible with jenkins so that the output can be displayed? – ChrisH Jun 13 '12 at 16:07
  • 1
    ynm3k had been upgraded in another fork https://github.com/douban/ynm3k, which replaced runTests.sh with test_runner/run. Not sure if the sample in the old project could still work. – firebear Aug 02 '14 at 10:21