$30 off During Our Annual Pro Sale. View Details »
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
63
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
2.2k
Mocks and Stubs and Spies, oh my!
briangardnerdev
1
220
Take a stab at test friendly architecture
briangardnerdev
1
150
Other Decks in Technology
See All in Technology
エンジニアとPMのドメイン知識の溝をなくす、 AIネイティブな開発プロセス
applism118
2
170
計算機科学をRubyと歩む 〜DFA型正規表現エンジンをつくる~
ydah
3
130
シンプルを極める。アンチパターンなDB設計の本質
facilo_inc
2
1.6k
Uncertainty in the LLM era - Science, more than scale
gaelvaroquaux
0
720
Oracle Cloud Infrastructure:2025年11月度サービス・アップデート
oracle4engineer
PRO
2
170
pmconf2025 - 他社事例を"自社仕様化"する技術_iRAFT法
daichi_yamashita
0
720
安いGPUレンタルサービスについて
aratako
2
2.6k
直接メモリアクセス
koba789
0
250
AI時代におけるアジャイル開発について
polyscape_inc
0
120
LLM-Readyなデータ基盤を高速に構築するためのアジャイルデータモデリングの実例
kashira
0
120
ML PM Talk #1 - ML PMの分類に関する考察
lycorptech_jp
PRO
1
650
.NET 10 のパフォーマンス改善
nenonaninu
2
4.9k
Featured
See All Featured
Scaling GitHub
holman
464
140k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Code Review Best Practice
trishagee
73
19k
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
4 Signs Your Business is Dying
shpigford
186
22k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Writing Fast Ruby
sferik
630
62k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
54k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
380
Documentation Writing (for coders)
carmenintech
76
5.2k
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