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
67
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
86
Sorcery with Sourcery
marciliojrs
0
46
Ferramentas Indispensáveis no Desenvolvimento iOS
marciliojrs
1
130
Other Decks in Programming
See All in Programming
技術記事、 専門家としてのプログラマ、 言語化
mizchi
14
7.2k
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
240
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
150
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
230
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
630
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
220
SLOをサービス品質の共通言語にするために 取り組んできたこと
wakana0222
0
280
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
0
190
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
290
Oxcを導入して開発体験が向上した話
yug1224
4
370
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.7k
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.8k
Featured
See All Featured
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
240
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
580
Documentation Writing (for coders)
carmenintech
77
5.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
150
How to make the Groovebox
asonas
2
2.3k
We Have a Design System, Now What?
morganepeng
55
8.2k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
430
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
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