I Have Tests - So What?
• How do we know we’ve done a good
job of testing our code?
• How do we know potential problem
areas in our code?
Monday, May 6, 13
Slide 19
Slide 19 text
Code Coverage!
Monday, May 6, 13
Slide 20
Slide 20 text
iOS Code Coverage
Tools
• CoverStory
Monday, May 6, 13
Testing Triangle
(c) Patrick Wilson Welsh
Monday, May 6, 13
Slide 23
Slide 23 text
Calabash and Cucumber
• Behavior Driven Development
• Given - When - Then (can be written by
anyone in the organization)
• Also exists for Android and tests can be
reused!
Monday, May 6, 13
Slide 24
Slide 24 text
Calabash - How To Get It
• Cocoapods support isn’t ready yet :(
• It is a Ruby gem, though!
• gem install calabash-cucumber
• calabash-ios setup (adds Xcode target)
• calabash-ios gen (adds features dir)
Monday, May 6, 13
Slide 25
Slide 25 text
Calabash - Setup
Monday, May 6, 13
Slide 26
Slide 26 text
Calabash - The Tests
• Features
• “As a” - “I want” - “So that”
• Scenarios
• “Given” - “When” - “Then”
Monday, May 6, 13
Slide 27
Slide 27 text
Calabash - The Tests
Monday, May 6, 13
Slide 28
Slide 28 text
Calabash - Running
• Launch the new scheme from Xcode
• “cucumber”
• How does it know what to click?
Monday, May 6, 13
Slide 29
Slide 29 text
Calabash - Built-In
Steps
• Screenshots: “take picture”
• Touching: “Then I touch the ‘login’ button”
• Entering text: “Then I enter ‘text’ into input field number 1”
• Waiting: “Then I wait for the ‘login’ button to appear”
• Back button: “Then I go back”
• Swipes: “Then I swipe left”
• Pinch: “Then I pinch to zoom in on ‘myLabel’ ”
• Scrolling: “Then I scroll down”
• Rotation: “Then I rotate device left”
Monday, May 6, 13
Slide 30
Slide 30 text
Calabash
• Command-line tool to query while
simulator is running
• Helps to turn on accessibility tool on
phone/simulator
Monday, May 6, 13
Slide 31
Slide 31 text
Next Steps
• xctool - Facebook’s alternative build
tool - and it’s good!
• ocunit2junit
Monday, May 6, 13
Slide 32
Slide 32 text
(Re)Sources
• Setting up testing in iOS: http://bit.ly/W8DDYd
• Setting up Calabash for iOS: http://bit.ly/RZdrxr
• http://cocoapods.org/
• https://github.com/allending/Kiwi
• https://github.com/calabash/calabash-ios
• https://github.com/facebook/xctool
• https://code.google.com/p/coverstory/
• https://github.com/jonreid/XcodeCoverage
• http://jenkins-ci.org/
• http://calaba.sh/
• OCUnit vs. GHUnit: http://bit.ly/dFbTCn
• Testing Triangle: http://patrickwilsonwelsh.com/?p=32
Monday, May 6, 13