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
760
От задач к проблемам
dalog
1
220
Unlimited power of Data-Driven UI
dalog
4
610
Data-Driven View Controllers. Tips and Tricks
dalog
5
1.8k
2 years of Redux in iOS. Lessons learned
dalog
0
340
Why unidirectional architecture matter for iOS.
dalog
1
270
Mobile backend without REST
dalog
2
86
Self managed teams 101
dalog
0
130
Other Decks in Programming
See All in Programming
最近のVS Codeで気になるニュース 2025/01
74th
1
110
DMMオンラインサロンアプリのSwift化
hayatan
0
190
Alba: Why, How and What's So Interesting
okuramasafumi
0
210
Scaling your build logic
antalmonori
1
100
知られざるDMMデータエンジニアの生態 〜かつてツチノコと呼ばれし者〜
takaha4k
1
480
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
190
Запуск 1С:УХ в крупном энтерпрайзе: мечта и реальность ПМа
lamodatech
0
960
Package Traits
ikesyo
1
210
はてなにおけるfujiwara-wareの活用やecspressoのCI/CD構成 / Fujiwara Tech Conference 2025
cohalz
3
2.8k
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
1.3k
QA環境で誰でも自由自在に現在時刻を操って検証できるようにした話
kalibora
1
140
良いユニットテストを書こう
mototakatsu
11
3.6k
Featured
See All Featured
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
4
180
Faster Mobile Websites
deanohume
305
30k
Making the Leap to Tech Lead
cromwellryan
133
9k
Thoughts on Productivity
jonyablonski
68
4.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
960
Speed Design
sergeychernyshev
25
740
How STYLIGHT went responsive
nonsquared
96
5.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
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