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
Tests
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Thibaut Coutard
February 10, 2020
Programming
58
0
Share
Tests
1- definitions
2- tools
3- iOS frameworks
Thibaut Coutard
February 10, 2020
More Decks by Thibaut Coutard
See All by Thibaut Coutard
iOS ecosystem
coutart
0
35
Clean Architecture
coutart
0
48
Iterate your Klingon
coutart
0
120
Workshop : CI - CD using Bitrise
coutart
0
71
Internationalisation
coutart
0
38
Other Decks in Programming
See All in Programming
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
210
Talking to terminals (and how they talk back) (KotlinConf 2026)
jakewharton
PRO
1
170
3Dシーンの圧縮
fadis
1
560
AIとRubyの静的型付け
ukin0k0
0
500
CSC307 Lecture 17
javiergs
PRO
0
310
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
310
ビジネスモデルから紐解く、AI+型駆動開発
hirokiomote
2
5.1k
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
310
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
520
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
1.2k
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
7
3.2k
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
180
Featured
See All Featured
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
70
39k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
240
Crafting Experiences
bethany
1
160
A better future with KSS
kneath
240
18k
ラッコキーワード サービス紹介資料
rakko
1
3.5M
We Have a Design System, Now What?
morganepeng
55
8.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Become a Pro
speakerdeck
PRO
31
6k
How to make the Groovebox
asonas
2
2.2k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
280
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
190
Transcript
Tests Thibaut Coutard iOS developer @MobiApps
Why ?
Why ? • More stable applications • Less bugs •
More confidence • Use it as documentation
-Djikstra « Testing shows the presence, not the absence of
bugs »
What kind of tests
Tests pyramid Manual UI Tests Integration Tests Unit tests
Integration Tests UI Tests Manual Cost Unit tests
Unit Test • Individual test • Unit smallest part of
the system • Simplest way to test • Lowest cost • Few seconds
Integration Test • Interaction between components • At least two
or more components • Less tests than UT • Relatively low cost • Seconds/Minutes
UI Test • Test the whole system • Still automated
• Harder to test • Still cheaper than manually • Minutes/Hours
Manual Test • Test the whole system • Hard to
test all cases • Very Expensive • Hours/Days
Feedback loop • Time between creating a bug and fixing
it
Mutation Testing
Mutation Testing
Mutation Testing • Test the tests
TDD Red Green Write failing test Develop Refactor
BDD • Gherkin : Given/When/Then • Understandable by everyone •
Speaks about the user behavior and not the technical behavior • Written with both product, development teams and customer
« What goes in production is the developers understanding »
Tools
Dependency Injection UserInteractor UserDefaults
Dependency Injection UserInteractor UserDefaults
Dependency Injection UserInteractor UserDefaults UserStoreProtocol
Dummy
None
Fake • Return static values
None
Stub • Return values • Can be set during the
test
Stub
Spy • Spy the calls
None
Mock • Return values • Can be set during the
test • Spy the calls
None
Humble Objects ViewController
Humble Objects ViewController Presenter
Humble Objects ViewController Presenter Not testable Testable
Useful libraries
XCTests • Unit test Framework native
XCTests
XCUITest • Native UI Test framework • Record from usage
XCUITest • Native UI Test framework • Record from usage
Nimble • A matcher framework for swift and objective-c •
Easier to read than XCTests
Nimble
Quick • BDD framework for swift and objective-c • Can
be written using the specifications • Easier to read and write
Quick
OHHttpStub • Stub HTTP calls for the whole app •
Helps test API wrappers • Can simulate bad/no network
OHHttpStub • Stub HTTP calls for the whole app •
Helps test API wrappers
KIF • Functional testing • Easier than XCUITests
KIF • Functional testing • Easier than XCUITests
HS : Sourcery • Meta Programming • Generate code •
Awesome AutoMockable template
HS : Sourcery • Meta Programming • Generate code •
Awesome AutoMockable template
Resources • Test Driven iOS Development with Swift 4 •
https://github.com/kif-framework/KIF • https://github.com/Quick/Nimble • https://github.com/Quick/Quick • https://github.com/AliSoftware/OHHTTPStubs