Continuous Integration for iOS with Xcode Server

5,614 views

Published on

With Apple’s App Store review process, making your submission bug-free and high-quality is of utmost importance. Continuous Integration is a testing practice utilized to ensure a highly-tested build is always available for shipping. Jenkins is a popular continuous integration suite, but it was not designed for iOS development and has several limitations. Apple released their continuous integration server, Xcode Server, with Xcode 5 last summer. In the talk, we examine the prerequisites to setting up continuous integration, the details of creating bots on Xcode Server, and the features that are available on Xcode Server along with their uses. Finally, we present a list of caveats to be aware of when planning a continuous integration implementation.
Kiel Oleson is an iOS Mobile Software Engineer at Eventbrite in San Francisco. Since joining Eventbrite in 2010 as their first dedicated iOS engineer, he has led from-scratch development of Eventbrite’s eponymous application for event attendees and Eventbrite At The Door, a ticket point-of-sale system. Prior to writing software for iOS, he wrote WebKit-based software for Mac OS X with Cocoa and Qt. Kiel is an advocate of test-driven development and continuous integration in the iOS community, from its roots in UIAutomation, OCUnit and shell scripts to today’s KIF, XCTest, and Xcode Server.

Kiel moved to San Francisco from Missouri and is a graduate of the Raikes School at the University of Nebraska. When he isn’t improving his software’s reliability and user experience, he is in his car trying to improve his lap times at the racetrack.

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
  • Nice! You might also be interested in trying www.buddybuild.com for iOS CI
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
5,614
On SlideShare
0
From Embeds
0
Number of Embeds
72
Actions
Shares
0
Downloads
58
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Continuous Integration for iOS with Xcode Server

  1. 1. CONTINUOUS INTEGRATION for iOS
  2. 2. KIEL OLESON @KielO
  3. 3. CONTINUOUS INTEGRATION • Keep the build alive • Run all the tests, all the time • TDD’s best friend • The intersection of development and QA
  4. 4. CONTINUOUS INTEGRATION SOURCE CONTROL TESTS SERVER CI
  5. 5. JENKINS • Must run on OS X for simulator support • Fragile build scripts • Even more fragile run scripts • Reporting is e-mail based
  6. 6. is here. AN ALTERNATIVE
  7. 7. XCODE 5 Xcode Server and Bots
  8. 8. PREREQUISITES • Source Control • Dependency management • CocoaPods • git Submodules • Schemes • TESTS. • Things to make tests possible • categories • mock objects • mock server
  9. 9. SOURCE CONTROL • You are using Source Control, right?
  10. 10. DEPENDENCY MANAGEMENT
  11. 11. DEPENDENCY MANAGEMENT
  12. 12. XCODE SOURCE CONTROL • Submodules • Goofy branch behavior • xccheckoutdata • Important to make it happy since it’s the one telling CI what to do
  13. 13. SCHEMES • Shared • You are committing /xcshareddata/, right?
  14. 14. TESTS • You are writing tests, right? • OCUnit • XCTest • Something else? • Too bad!
  15. 15. MAKINGTESTS POSSIBLE • KIF • Test your UI like a user! • Mock Objects • Test your objects like a caller! ! • Mock Server • Test your API responses without a server!
  16. 16. ASIDE: KIF • You are making your app accessible, right? • Use accessibility labels to UI test your app • KIF-Next aka KIF 3.0 • XCTest-based • https://github.com/kif-framework/KIF
  17. 17. ASIDE: TEST BUNDLES • OCUnit and XCTest run inside main target • Need to be crafty to make certain things work • Location Services without human interaction • Clearing Core Data, etc.
  18. 18. XCODE 5 and Bots
  19. 19. TEST NAVIGATOR
  20. 20. TEST NAVIGATOR • You are running your tests, right? • Run by... • Suite • Class • Test
  21. 21. TEST NAVIGATOR • Deep integration • Click a test name to see the code. • Test failure breakpoints • See Bot results in Xcode
  22. 22. BOTS • From Jenkins world? Think of them as very focused jobs. • One bot configuration • One branch • One schedule (daily, hourly, on commit) • One target
  23. 23. BOTS - EXAMPLES • On commit, make sure project builds with 0 errors, 0 warnings, 0 SA results • On commit, make sure project builds with 0 test failures. • Nightly, post a new build and keep it around for posterity
  24. 24. INTEGRATION
  25. 25. WEB INTERFACE
  26. 26. SCOREBOARD
  27. 27. SIMULATORTESTING • Fast, basic coverage • Cheap • Not a substitute for on-device testing
  28. 28. ON-DEVICETESTING • Real-world performance and functionality • Hook up devices to run tests on more targets • Form factors • iOS versions • 32-bit and 64-bit
  29. 29. CAVEATS • Submodules must be at HEAD of branch • Simulator keeps state between build runs • Make your tests and targets idempotent • git commit polling sometimes breaks • HTTP guest login is broken • No CocoaPods for you
  30. 30. XCODE SERVER SECRET LAIR
  31. 31. XCODE SERVER SECRET LAIR • /Library/Server/Xcode/ • /private/var/_xcstest
  32. 32. DON’T FIGHTTHE FUTURE “These are all new technologies that are a core of iOS 7 and had multiple sessions dedicated to them at Apple’s major developer event. You can be damn sure that the company is proud of them, and looking for developers to highlight who have integrated them into their apps.” ! - Justin Williams (@justin)
  33. 33. ADDITIONAL RESOURCES • CI Example Project • With Submodules • Without Submodules • http://github.com/koleson/
  34. 34. 🎉

×