Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Tests
Search
Thibaut Coutard
February 10, 2020
Programming
0
55
Tests
1- definitions
2- tools
3- iOS frameworks
Thibaut Coutard
February 10, 2020
Tweet
Share
More Decks by Thibaut Coutard
See All by Thibaut Coutard
iOS ecosystem
coutart
0
29
Clean Architecture
coutart
0
42
Iterate your Klingon
coutart
0
110
Workshop : CI - CD using Bitrise
coutart
0
60
Internationalisation
coutart
0
35
Other Decks in Programming
See All in Programming
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
350
認証・認可の基本を学ぼう後編
kouyuume
0
240
AIエージェントを活かすPM術 AI駆動開発の現場から
gyuta
0
430
俺流レスポンシブコーディング 2025
tak_dcxi
14
8.9k
エディターってAIで操作できるんだぜ
kis9a
0
730
AIコーディングエージェント(Manus)
kondai24
0
190
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.3k
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
180
「コードは上から下へ読むのが一番」と思った時に、思い出してほしい話
panda728
PRO
38
26k
chocoZAPサービス予約システムをNuxtで内製化した話
rizap_tech
0
160
AIコーディングエージェント(skywork)
kondai24
0
180
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
120
Featured
See All Featured
Scaling GitHub
holman
464
140k
Statistics for Hackers
jakevdp
799
230k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.3k
Writing Fast Ruby
sferik
630
62k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
970
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
GitHub's CSS Performance
jonrohan
1032
470k
Mobile First: as difficult as doing things right
swwweet
225
10k
Done Done
chrislema
186
16k
GraphQLとの向き合い方2022年版
quramy
50
14k
The Pragmatic Product Professional
lauravandoore
37
7.1k
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