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
Thibaut Coutard
February 10, 2020
Programming
0
56
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
30
Clean Architecture
coutart
0
42
Iterate your Klingon
coutart
0
120
Workshop : CI - CD using Bitrise
coutart
0
61
Internationalisation
coutart
0
35
Other Decks in Programming
See All in Programming
MUSUBIXとは
nahisaho
0
130
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
140
CSC307 Lecture 06
javiergs
PRO
0
680
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
160
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
510
CSC307 Lecture 08
javiergs
PRO
0
670
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.8k
Data-Centric Kaggle
isax1015
2
770
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
7
2.1k
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
300
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.3k
Featured
See All Featured
Building Adaptive Systems
keathley
44
2.9k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Facilitating Awesome Meetings
lara
57
6.7k
It's Worth the Effort
3n
188
29k
Site-Speed That Sticks
csswizardry
13
1.1k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
320
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
910
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
Mobile First: as difficult as doing things right
swwweet
225
10k
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