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
Unit Testing in Swift
Search
DAloG
March 19, 2016
Programming
2
350
Unit Testing in Swift
DAloG
March 19, 2016
Tweet
Share
More Decks by DAloG
See All by DAloG
State normalization (RU)
dalog
0
160
Redux + MQTT
dalog
1
750
От задач к проблемам
dalog
1
210
Unlimited power of Data-Driven UI
dalog
4
600
Data-Driven View Controllers. Tips and Tricks
dalog
5
1.8k
2 years of Redux in iOS. Lessons learned
dalog
0
330
Why unidirectional architecture matter for iOS.
dalog
1
260
Mobile backend without REST
dalog
2
83
Self managed teams 101
dalog
0
130
Other Decks in Programming
See All in Programming
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
200
Jakarta EE meets AI
ivargrimstad
0
600
CSC509 Lecture 09
javiergs
PRO
0
140
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
430
subpath importsで始めるモック生活
10tera
0
300
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
290
Remix on Hono on Cloudflare Workers
yusukebe
1
280
Featured
See All Featured
The Invisible Side of Design
smashingmag
298
50k
Facilitating Awesome Meetings
lara
50
6.1k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Why Our Code Smells
bkeepers
PRO
334
57k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
How to train your dragon (web standard)
notwaldorf
88
5.7k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Transcript
DO YOU WANT TO TALK ABOUT UNIT TESTIG IN SWIFT?
#itsat @daloog ¯\_(ϑ)_/¯ Alexey Demedetskiy Sigma Software
THANK YOU APPLE!
99% OF IOS APPS ARE SHIPPED WITH UNIT TESTING!
WORKOUT TIME!!
None
(˽°□°)˽Ɨ ˍʓˍ
ARE UNIT TESTS WORTH IT? HTTP://STACKOVERFLOW.COM/QUESTIONS/237000/IS- THERE-HARD-EVIDENCE-OF-THE-ROI-OF-UNIT-TESTING
TIME += 30% HTTP://COLLABORATION.CSC.NCSU.EDU/LAURIE/PAPERS/ TDDPAPERV8.PDF
DEFECTS -= 60% HTTP://RESEARCH.MICROSOFT.COM/EN-US/GROUPS/ESE/ NAGAPPAN_TDD.PDF
TESTS ARE GREAT!
!(ಠፅಠ!)
WHY WE ARE NOT RUBY?
None
1) MARKET HUSTLE
2) APPLE FRAMEWORKS
3) LACK OF EXPERTISE
4) OUTSOURCE
⌛ ➡
UNIT TESTS ARE WRITTEN BY DEVELOPERS.
None
TESTS ARE DEVELOPERS RESPONSIBILITY
DON’T SELL THEM WRITE THEM
WHY DO WE NEED TO WRITE TESTS?
1) REFACTORING
2) CONFIDENCE
3) CATCHING ERRORS
4) REGRESSION
➡❌➡⌨➡✅
HOW TO WRITE TESTS?
None
UNIT AS SMALLEST LOGIC CONTAINER
FUNCTION
INPUT ➡ OUTPUT
None
None
PURE FUNCTIONS
METHOD
MUTATION OF STATE
None
VOID ➡ VOID
INPUT ➡ OUTPUT
DOMAIN == CODOMAIN
ALL MY CODE IS FUNCTIONAL, WHERE EVERY FUNCTION TAKES ONE
ARGUMENT: ALL MY PROGRAM'S STATE.
OBJECT
None
DEPENDENCIES
TRANSITIVE DEPENDENCIES
None
INITIAL STATE
ORDER OF OPERATIONS
UNIT AS SMALLEST LOGIC CONTAINER
None
TESTS
GWT
GIVEN WHEN THEN
None
AAA
ARRANGE ACT ASSERT
None
SRV
SETUP RECORD VERIFY
FUNCTIONS - GWT
METHODS - AAA
OBJECTS - SRV
VALUE TESTS
BEHAVIOR TESTS
INTEGRATION TESTS
CLIENT TESTS
PYRAMID OF TESTS HTTP://TODDLITTLEWEB.COM/WORDPRESS/2014/06/23/ THE-TESTING-DIAMOND-AND-THE-PYRAMID-2/
None
None
TEST COVERAGE HTTP://MARTINFOWLER.COM/BLIKI/ TESTCOVERAGE.HTML
None
None
TESTS
None
SIDE EFFECTS
RETURN VALUE
FUNCTION CALL
STATE CHANGE
SIDE EFFECTS
None
SWIFT
DEPENDENCIES
STRUCT
INTERNAL
None
PROTOCOL
EXTERNAL
XCTEST
QUICK / NIMBLE HTTPS://GITHUB.COM/QUICK/QUICK
RECORDER HTTPS://GIST.GITHUB.COM/ALEXEYDEMEDETSKIY/ 7A148559C81472A314F7
None
SWIFT
None
None
HTTPS://GITHUB.COM/XNEKOIX/FUNTIONALMVP
HTTP://WWW.AMAZON.COM/WORKING-EFFECTIVELY- LEGACY-MICHAEL-FEATHERS/DP/0131177052
HTTP://WWW.AMAZON.COM/EXTREME-PROGRAMMING- EXPLAINED-EMBRACE-EDITION/DP/0321278658
QUESTIONS: @DALOOG
[email protected]
NOBIDON