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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Thibaut Coutard
February 10, 2020
Programming
56
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
30
Clean Architecture
coutart
0
42
Iterate your Klingon
coutart
0
120
Workshop : CI - CD using Bitrise
coutart
0
63
Internationalisation
coutart
0
35
Other Decks in Programming
See All in Programming
一度始めたらやめられない開発効率向上術 / Findy あなたのdotfilesを教えて!
k0kubun
3
2.5k
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
320
GoのDB アクセスにおける 「型安全」と「柔軟性」の両立 - Bob という選択肢
tak848
0
290
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
580
Rethinking API Platform Filters
vinceamstoutz
0
4.2k
野球解説AI Agentを開発してみた - 2026/02/27 LayerX社内LT会資料
shinyorke
PRO
0
380
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.3k
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
310
AI 開発合宿を通して得た学び
niftycorp
PRO
0
180
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
220
AI時代のシステム設計:ドメインモデルで変更しやすさを守る設計戦略
masuda220
PRO
6
1.1k
Strategy for Finding a Problem for OSS: With Real Examples
kibitan
0
130
Featured
See All Featured
Darren the Foodie - Storyboard
khoart
PRO
3
3.1k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
120
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
160
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
A Tale of Four Properties
chriscoyier
163
24k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
100
Visualization
eitanlees
150
17k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
180
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
160
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
130
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
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