continuous integration for ios with xcode server

Post on 15-May-2015

2.921 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

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.

TRANSCRIPT

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/

🎉

top related