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
Mocks and Stubs and Spies, oh my!
Search
Brian Gardner
August 27, 2018
Technology
1
55
Mocks and Stubs and Spies, oh my!
Slides from my introduction to test doubles talk given at DroidCon NYC
Brian Gardner
August 27, 2018
Tweet
Share
More Decks by Brian Gardner
See All by Brian Gardner
GoogleMap DroidCon SF 23
briangardnerdev
0
1.9k
Mocks and Stubs and Spies, oh my!
briangardnerdev
1
210
Take a stab at test friendly architecture
briangardnerdev
1
150
Other Decks in Technology
See All in Technology
「自動テストのプラクティスを効果的に学ぶためのカードゲーム」 ( #sqip2024 )
teyamagu
PRO
2
180
ついに出た!OpenAIの最新モデル「o1」って何がすごいの?
minorun365
PRO
3
1.2k
スタッフエンジニアの道: The Staff Engineer’s Path
snoozer05
PRO
44
14k
Developer Experienceを向上させる基盤づくりの取り組み事例集
coconala_engineer
0
150
フルカイテン株式会社 採用資料
fullkaiten
0
32k
あなたの知らないiOS開発の世界
recruitengineers
PRO
3
180
とあるOSSを継続可能にするための取り組みについて / OSS Refactoring Process
bun913
1
210
PDF Viewer作成の今までとこれから
hunachi
0
480
OCI で始める!! Red Hat OpenShift / Get Started OpenShift on OCI
oracle4engineer
PRO
1
190
たった1人からはじめる【Agile Community of Practice】~ソース原理とFearless Changeを添えて~
ktc_corporate_it
1
500
The XZ Backdoor Story
fr0gger
0
3.6k
ロリポップ! for Gamersを支えるインフラ/lolipop for gamers infrastructure
takumakume
0
140
Featured
See All Featured
From Idea to $5000 a Month in 5 Months
shpigford
379
46k
BBQ
matthewcrist
83
9.2k
KATA
mclloyd
27
13k
Debugging Ruby Performance
tmm1
72
12k
GraphQLとの向き合い方2022年版
quramy
43
13k
GitHub's CSS Performance
jonrohan
1030
450k
Into the Great Unknown - MozCon
thekraken
29
1.4k
RailsConf 2023
tenderlove
28
810
Designing Dashboards & Data Visualisations in Web Apps
destraynor
227
52k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
1
55
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
24
610
Web Components: a chance to create the future
zenorocha
309
42k
Transcript
Mocks and Stubs and Spies, Oh My! Brian Gardner
Test Double Hierarchy Test Doubles Mock Fake Spy Stub Dummy
Types of Tests
When to use Test Doubles? • System under test has
indirect inputs • System under test has indirect outputs • Slow tests*
Indirect Inputs
Indirect Outputs
Slow Tests
Mocks
What is a Mock?
What is a Mock?
What is a Mock?
Mock Types Mocks Strict Lenient
Mock Usage
Mock Usage
Mock Usage
Mock Usage
Stubs
What is a Stub?
What is a Stub?
What is a Stub?
Stub Types Stubs Responder Saboteur Temporary
Stub Usage
Stub Usage
Stub Usage
Stub Usage
Spies
What is a Spy?
Spy Usage
Spy Usage
Spy Usage
Spy Usage
Dummies
What is a Dummy?
What is a Dummy?
Dummy Usage
Dummy Usage
Dummy Usage
Dummy Usage
Fakes
What is a Fake?
Fake Usage
Fake Usage
Fake Usage
Fake Usage
Term Confusion
Mocking Library
Mockito mocks
Mockito Stubs
Mockito Spies
Actual Mockito Spies
Mockito dummies
Mockito Fakes N/A
Recap • Use correct terms for more effective communication •
Match test doubles to the appropriate tests • Don’t over use them
Who am I? Brian Gardner @BrianGardnerAtl