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
0
60
iOS Unit Testing
Digital Day BH 2016
Github:
https://github.com/marciliojrs/DigitalDayBH2016
Marcilio Junior
September 03, 2016
Tweet
Share
More Decks by Marcilio Junior
See All by Marcilio Junior
Making Sourcery write code for you
marciliojrs
0
71
Sorcery with Sourcery
marciliojrs
0
39
Ferramentas Indispensáveis no Desenvolvimento iOS
marciliojrs
1
120
Other Decks in Programming
See All in Programming
Deep Dive into ~/.claude/projects
hiragram
9
1.6k
プロダクト志向ってなんなんだろうね
righttouch
PRO
0
170
関数型まつりレポート for JuliaTokai #22
antimon2
0
160
datadog dash 2025 LLM observability for reliability and stability
ivry_presentationmaterials
0
170
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う Swift の仕様 / from Kotlin to Swift
lovee
1
260
ruby.wasmで多人数リアルタイム通信ゲームを作ろう
lnit
2
290
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
460
PostgreSQLのRow Level SecurityをPHPのORMで扱う Eloquent vs Doctrine #phpcon #track2
77web
2
390
CursorはMCPを使った方が良いぞ
taigakono
1
190
型付きアクターモデルがもたらす分散シミュレーションの未来
piyo7
0
810
Cline指示通りに動かない? AI小説エージェントで学ぶ指示書の書き方と自動アップデートの仕組み
kamomeashizawa
1
580
Bytecode Manipulation 으로 생산성 높이기
bigstark
2
380
Featured
See All Featured
The Language of Interfaces
destraynor
158
25k
Art, The Web, and Tiny UX
lynnandtonic
299
21k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
Site-Speed That Sticks
csswizardry
10
660
Faster Mobile Websites
deanohume
307
31k
How to train your dragon (web standard)
notwaldorf
94
6.1k
A Modern Web Designer's Workflow
chriscoyier
694
190k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Gamification - CAS2011
davidbonilla
81
5.3k
Designing for Performance
lara
609
69k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
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