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
340
Unit Testing in Swift
DAloG
March 19, 2016
Tweet
Share
More Decks by DAloG
See All by DAloG
State normalization (RU)
dalog
0
150
Redux + MQTT
dalog
1
750
От задач к проблемам
dalog
1
200
Unlimited power of Data-Driven UI
dalog
4
590
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
82
Self managed teams 101
dalog
0
130
Other Decks in Programming
See All in Programming
Scala アプリケーションのビルドを改善してデプロイ時間を 1/4 にした話 | How I improved the build of my Scala application and reduced deployment time by 4x
nomadblacky
1
180
オートマトン学習しろ / Do automata learning
makenowjust
3
130
Increased Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
380
How to Break into Reading Open Source
kaspth
2
210
RAGの回答精度評価用のQAデータセットを生成AIに作らせた話
kurahara
0
250
LangChainでWebサイトの内容取得やGitHubソースコード取得
shukob
0
160
LangGraphでのHuman-in-the-Loopの実装
os1ma
3
1.1k
Securify_エンジニア採用資料
3shake
0
100
事業フェーズの変化に対応する 開発生産性向上のゼロイチ
masaygggg
0
200
Android開発以外のAndroid開発経験の活かしどころ
konifar
2
1k
Developer Joy == Developer Productivity (really!)
hollycummins
1
220
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
390
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
47
48k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
248
20k
Navigating Team Friction
lara
183
13k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
157
15k
Building Better People: How to give real-time feedback that sticks.
wjessup
359
19k
[RailsConf 2023] Rails as a piece of cake
palkan
48
4.6k
Raft: Consensus for Rubyists
vanstee
135
6.5k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
28
1.6k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
41
6.5k
The Brand Is Dead. Long Live the Brand.
mthomps
53
38k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
354
29k
Teambox: Starting and Learning
jrom
131
8.7k
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