How to Troubleshoot Apps for the Modern Connected Worker
Tokyo iOS Meetup - 409 - Testing In XCode
1. 409 - TESTING IN XCODE
Gavin Thomas
ippoippo-software@ippoippo-eco.com
@IppoippoSftware
www.ippoippo-software.com
Sunday, 20 October 13
2. WHO AM I?
• Previously
an Enterprise Java developer for 15 years for
my day job
• Now
work as Ruby developer for my day job
• Mac
user since 2006, iOS devices since 2008.
• Dabbled
with Obj-C since 2008, but started investing
more time from start of this year.
Sunday, 20 October 13
6. WHY?
•
The Ruby development world has a strong testing ethos, typically ‘spec’ (or human
readable) orientated. Leads the way, but sometimes tooling is fragile.
•
Enterprise Java development world was slower to catch on, but JUnit is used heavily now.
However, the tooling is solid.
•
Despite xUnit coming from Smalltalk, historically Unit Testing was never big in ‘old’
Objective-C world.
•
New generation of Obj-C devs are driving Unit Testing with 3rd party tools (Kiwi, Expecta,
OCMock, OCMockito, Specta)
Sunday, 20 October 13
7. WHAT’S THE MAIN TOPIC IN THE
VIDEO?
• Unit
Testing basics (why and what) 04:14 to 07:15
• New
Frameworks and Tools (XCTest and XCode
updates) 07:15 to 33:20
• Continuous
Sunday, 20 October 13
Integration 33:20 to 45:00
8. WHAT KIND OF VALUE FROM
WATCHING IT?
• New
Objective-C developers who have not experienced
Unit Testing elsewhere get an overview of the ‘why’?
• Understand
that Apple is adopting ‘best practice’ as
used elsewhere in the industry.
• For
experienced ‘unit testers’, understand what
improvements Apple has added to tools (and to
understand what is still missing)
Sunday, 20 October 13
9. MOST INTERESTING POINTS?
• 1:18
- “Why Test?” According to Apple
• Catch
‘crashers’ - No1 reason why apps are rejected.
• Helps
development in teams
Sunday, 20 October 13
10. MOST INTERESTING POINTS?
• 7:09
- “Where to start
testing”
• Using
out of the box XCode
tools, Models and Controllers
are ‘easier’ to test.
Sunday, 20 October 13
11. MOST INTERESTING POINTS?
• 10:25
• For
- Test Navigator
previous IntelliJ,
RubyMine, Eclipse etc
users... IDE tools
Sunday, 20 October 13
12. MOST INTERESTING POINTS?
• 20:00
- Checklist for what
you should test for
• For
people experience in
Unit Testing in other
languages, but new to
Objective-C...
• The
failures to check for list
is very useful as Objective-C
specific
Sunday, 20 October 13
13. MOST INTERESTING POINTS?
• 21:22
- setUp
• ‘shim’
==> Ohh, you mean a
mock object!
• So,
XCTest comes with
Mocking support, No?
Dammit!
• We
rely on 3rd-parties still,
like OCMock, or OCMockito
(or Kiwi)
Sunday, 20 October 13
14. MOST INTERESTING POINTS?
• 23:35
• If
- iOS6
you want to support iOS6,
you need to use the older
OCTest still!
Sunday, 20 October 13
15. MOST INTERESTING POINTS?
• 33:20
- CI with an Apple
flavour
• Relies
on OS X Server, rather
than support for existing tools
(like Jenkins etc).
• Allows
testing of software on
•
Multiple connected iOS Devices
•
Multiple iOS Sims
•
Multiple iOS Versions
Sunday, 20 October 13
Failing on iPad mini iOS6,
working on iPhone iOS7
16. MOST INTERESTING POINTS?
• 46:42
- Already have CI
(example, company doing
non Obj-C work as well as
iOS Apps)?
• Use
the command line tools,
and integrate that way rather
than rely on OS X Server
Sunday, 20 October 13
17. OTHER RESOURCES
• http://iosunittesting.com
• http://qualitycoding.org
• http://pragprog.com/magazines/2012-10/its-not-about-
the-unit-tests
•
“iOS developers generally don’t unit test. So why then do they as a community seem to
enjoy a reputation for quality? No unit tests. No continuous integration. No TDD.”
•
An out of date quote now? Unit Testing does not guarantee quality. However, it’s a tool
that helps you get there if you are already in the right ‘quality’ mindset.
Sunday, 20 October 13