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
360
Unit Testing in Swift
DAloG
March 19, 2016
Tweet
Share
More Decks by DAloG
See All by DAloG
State normalization (RU)
dalog
0
190
Redux + MQTT
dalog
1
780
От задач к проблемам
dalog
1
260
Unlimited power of Data-Driven UI
dalog
4
640
Data-Driven View Controllers. Tips and Tricks
dalog
5
1.9k
2 years of Redux in iOS. Lessons learned
dalog
0
380
Why unidirectional architecture matter for iOS.
dalog
1
290
Mobile backend without REST
dalog
2
110
Self managed teams 101
dalog
0
150
Other Decks in Programming
See All in Programming
CSC305 Summer Lecture 06
javiergs
PRO
0
100
あなたとJIT, 今すぐアセンブ ル
sisshiki1969
1
730
自作OSでDOOMを動かしてみた
zakki0925224
1
1.4k
画像コンペでのベースラインモデルの育て方
tattaka
3
1.9k
マイコンでもRustのtestがしたい その2/KernelVM Tokyo 18
tnishinaga
2
2.3k
Kiroの仕様駆動開発から見えてきたAIコーディングとの正しい付き合い方
clshinji
1
150
コーディングエージェント時代のNeovim
key60228
1
100
Dart 参戦!!静的型付き言語界の隠れた実力者
kno3a87
0
210
Flutter로 Gemini와 MCP를 활용한 Agentic App 만들기 - 박제창 2025 I/O Extended Seoul
itsmedreamwalker
0
150
The state patternの実践 個人開発で培ったpractice集
miyanokomiya
0
150
技術的負債で信頼性が限界だったWordPress運用をShifterで完全復活させた話
rvirus0817
1
2.1k
AIエージェント開発、DevOps and LLMOps
ymd65536
1
340
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Unsuck your backbone
ammeep
671
58k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
21k
We Have a Design System, Now What?
morganepeng
53
7.7k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.5k
The World Runs on Bad Software
bkeepers
PRO
70
11k
Documentation Writing (for coders)
carmenintech
73
5k
The Invisible Side of Design
smashingmag
301
51k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Designing for humans not robots
tammielis
253
25k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
780
Practical Orchestrator
shlominoach
190
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