Continuous Integration for iOS with Xcode Server
-
Upload
kiel-oleson -
Category
Technology
-
view
2.918 -
download
0
description
Transcript of Continuous Integration for iOS with Xcode Server
CONTINUOUS INTEGRATION for iOS
KIEL OLESON@KielO
CONTINUOUS INTEGRATION
• Keep the build alive
• Run all the tests, all the time
• TDD’s best friend
• The intersection of development and QA
CONTINUOUS INTEGRATIONSOURCE CONTROL
TESTS SERVER
CI
JENKINS
• Must run on OS X for simulator support
• Fragile build scripts
• Even more fragile run scripts
• Reporting is e-mail based
is here.AN ALTERNATIVE
XCODE 5Xcode Server and Bots
PREREQUISITES
• Source Control
• Dependency management
• CocoaPods
• git Submodules
• Schemes
• TESTS.
• Things to make tests possible
• categories
• mock objects
• mock server
SOURCE CONTROL
• You are using Source Control, right?
DEPENDENCY MANAGEMENT
DEPENDENCY MANAGEMENT
XCODE SOURCE CONTROL
• Submodules
• Goofy branch behavior
• xccheckoutdata
• Important to make it happy since it’s the one telling CI what to do
SCHEMES
• Shared
• You are committing /xcshareddata/, right?
TESTS
• You are writing tests, right?
• OCUnit
• XCTest
• Something else?
• Too bad!
MAKING TESTS 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!
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
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.
XCODE 5and Bots
TEST NAVIGATOR
TEST NAVIGATOR
• You are running your tests, right?
• Run by...
• Suite
• Class
• Test
TEST NAVIGATOR
• Deep integration
• Click a test name to see the code.
• Test failure breakpoints
• See Bot results in Xcode
BOTS
• From Jenkins world? Think of them as very focused jobs.
• One bot configuration
• One branch
• One schedule (daily, hourly, on commit)
• One target
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
INTEGRATION
WEB INTERFACE
SCOREBOARD
SIMULATOR TESTING
• Fast, basic coverage
• Cheap
• Not a substitute for on-device testing
ON-DEVICE TESTING
• Real-world performance and functionality
• Hook up devices to run tests on more targets
• Form factors
• iOS versions
• 32-bit and 64-bit
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
XCODE SERVER SECRET LAIR
XCODE SERVER SECRET LAIR
• /Library/Server/Xcode/
• /private/var/_xcstest
DON’T FIGHT THE 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)
ADDITIONAL RESOURCES
• CI Example Project
• With Submodules
• Without Submodules
• http://github.com/koleson/
🎉