Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Mocks and Stubs and Spies, oh my!
Search
Brian Gardner
August 27, 2018
Technology
93
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Mocks and Stubs and Spies, oh my!
Slides from my introduction to test doubles talk given at DroidCon NYC
Brian Gardner
August 27, 2018
Transcript
54 slides
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
More Decks by Brian Gardner
See All by Brian Gardner
GoogleMap DroidCon SF 23
briangardnerdev
0
2.5k
Mocks and Stubs and Spies, oh my!
briangardnerdev
1
250
Take a stab at test friendly architecture
briangardnerdev
1
180
Other Decks in Technology
See All in Technology
地域社会の実情からITエンジニアの社会貢献を考える
sms_tech
0
130
Bots in Kiro Crew (One point of contact for ongoing work) | Kiro: Zero to Hero 12
inariku
PRO
1
130
AI時代における医療情報システムのセキュリティ / Security of Healthcare IT Systems in the AI Era
henryofficial
0
150
速くなるほど、深く考える AI時代のQAに学ぶ
kobayashiyorimitsu
0
170
AIエージェントの監視、思考を見るか行動を見るか / Monitoring AI Agents: Thoughts or Actions
yusukeshimizu
2
190
Shared Signals Framework 仕様解説
oidfj
0
420
Claude Codeで新規事業を伸ばせるか? Zennの試行錯誤の記録
wadayusuke
2
160
大江戸Ruby会議でデータベース クライアントの話をするのは 間違っているだろうか
yahonda
1
120
田んぼの見回りをIoTで減らしたい!水位監視から電池駆動カメラまでの試行錯誤
itosoft
1
120
令和の今、あらためて IAM を考える。アクセスキーを「無くせない現実」との向き合い方
kazzpapa3
0
680
あの日、見つかっていなかったらどうなっていたか
kazzpapa3
2
160
JAWS_FESTA2026_オンプレ-AWS間プロキシサーバの移行_性能_障害対応で得た実践ノウハウ_高島一晃.pdf
tkazuaki0820
1
110
Featured
See All Featured
Speed Design
sergeychernyshev
33
2.2k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
900
Balancing Empowerment & Direction
lara
6
1.4k
A Soul's Torment
seathinner
9
3.9k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Un-Boring Meetings
codingconduct
0
490
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Facilitating Awesome Meetings
lara
57
7.2k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
The Invisible Side of Design
smashingmag
301
52k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
Design in an AI World
tapps
1
390