Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
iOS Unit Testing
Search
Marcilio Junior
September 03, 2016
Programming
64
0
Share
iOS Unit Testing
Digital Day BH 2016
Github:
https://github.com/marciliojrs/DigitalDayBH2016
Marcilio Junior
September 03, 2016
More Decks by Marcilio Junior
See All by Marcilio Junior
Making Sourcery write code for you
marciliojrs
0
77
Sorcery with Sourcery
marciliojrs
0
43
Ferramentas Indispensáveis no Desenvolvimento iOS
marciliojrs
1
120
Other Decks in Programming
See All in Programming
JOAI2026 1st solution - heron0519 -
heron0519
0
120
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
1
300
瑠璃の宝石に学ぶ技術の声の聴き方 / 【劇場版】アニメから得た学びを発表会2026 #エンジニアニメ
mazrean
0
240
Getting more out of Maven
mlvandijk
0
110
Make GenAI Production-Ready with Kubernetes Patterns
bibryam
0
120
実用!Hono RPC2026
yodaka
2
170
t *testing.T は どこからやってくるの?
otakakot
0
500
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
320
2026_04_15_量子計算をパズルとして解く
hideakitakechi
0
100
JAWS-UG横浜 #100 祝・第100回スペシャルAWS は VPC レスの時代へ
maroon1st
0
120
CDK Deployのための ”反響定位”
watany
4
750
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.9k
Featured
See All Featured
Mind Mapping
helmedeiros
PRO
1
150
Being A Developer After 40
akosma
91
590k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
210
HDC tutorial
michielstock
2
620
Design in an AI World
tapps
0
190
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
770
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
170
Claude Code のすすめ
schroneko
67
220k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Bash Introduction
62gerente
615
210k
Transcript
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
iOS
unit Testing
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
who
am i iOS Lead @ HE:labs iOS Instructor @ Framework Training Center Professor @ PUC Minas CocoaHeads BH Co-organizer Marcílio Júnior
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
unit
Testing WHY?
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
Why
test • Avoid break your codebase • It’s a way to document your code • Make development faster • Reduce your fear • Improve your code quality
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
what
to test • If possible, everything
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
TYPEs
of unit tests
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
unit
test types • Mathematical • Pure functions • Delegation • Output
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
unit
test types • Mathematical • Delegation • Propagation • Output
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
unit
test types • Mathematical • Delegation • Output • More than one input/output
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
(B/T)DD
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
(B/T)DD
• Test-Driven Development • Behaviour-Driven Development
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
(B/T)DD
• Test-Driven Development • Behaviour-Driven Development let counter = Counter() let expectedCount = 1 counter.tick() XCTAssertEqual(counter.count, expectedCount)
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
(B/T)DD
• Test-Driven Development • Behaviour-Driven Development describe("Counter") { var counter: Counter! beforeEach { counter = Counter() } it("should increase count by 1 after calling tick") { let expectedCount = counter.count + 1 counter.tick() expect(counter.count).to(be(expectedCount)) } }
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
TESTING
frameworks • XCTest • Quick
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
TESTING
frameworks • XCTest • default testing framework of Xcode • Quick
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
TESTING
frameworks • XCTest • Quick • BDD testing framework
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
quick
• https://github.com/Quick/Quick • Inspired by RSpec, Specta e Ginkgo • Swift & Objective-C support • It comes with a great matcher framework: Nimble
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
quick
• BDD DSL • describe • context • it • beforeEach • afterEach
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
testable
imports • @testable import • allows use your internal classes in unit test target • don’t need to set the unit test target to all your classes
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
live
coding
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
one
more thing...
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
tips
• Dependency injection • Testable architectures • Mocks & Stubs • Code Coverage
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
QUestions?
DIGITAL DAY - SEP 3, 2016 MARCÍLIO JÚNIOR
[email protected]
thanks!
@marciliojrs /in/marciliojunior
[email protected]
@marcilio iOSDevBR @marciliojrs