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
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
400
From Subtype Polymorphism To Typeclass-based Ad hoc Polymorphism- An Example
philipschwarz
PRO
0
170
Sidekiqで実現する 長時間非同期処理の中断と再開 / Pausing and Resuming Long-Running Asynchronous Jobs with Sidekiq
hypermkt
6
2.7k
Modern Angular: Renovation for Your Applications
manfredsteyer
PRO
0
210
WEBエンジニア向けAI活用入門
sutetotanuki
0
300
レガシーな Android アプリのリアーキテクチャ戦略
oidy
1
170
CPython 인터프리터 구조 파헤치기 - PyCon Korea 24
kennethanceyer
0
240
Vue SFCのtemplateでTypeScriptの型を活用しよう
tsukkee
3
1.5k
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
23k
Vue.js学習の振り返り
hiro_xre
2
130
Macとオーディオ再生 2024/11/02
yusukeito
0
190
Nuxtベースの「WXT」でChrome拡張を作成する | Vue Fes 2024 ランチセッション
moshi1121
1
520
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
363
19k
Gamification - CAS2011
davidbonilla
80
5k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
664
120k
Building an army of robots
kneath
302
42k
A Philosophy of Restraint
colly
203
16k
How to Ace a Technical Interview
jacobian
275
23k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
22k
Why Our Code Smells
bkeepers
PRO
334
57k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
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