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
62
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
Grafana MCPサーバーによるAIエージェント経由でのGrafanaダッシュボード動的生成
hamadakoji
1
1.3k
2025年になってもまだMySQLが好き
yoku0825
8
4.1k
AI エージェントとはそもそも何か? - 技術背景から Amazon Bedrock AgentCore での実装まで- / AI Agent Unicorn Day 2025
hariby
4
1.1k
テストを軸にした生き残り術
kworkdev
PRO
0
170
La gouvernance territoriale des données grâce à la plateforme Terreze
bluehats
0
110
なぜスクラムはこうなったのか?歴史が教えてくれたこと/Shall we explore the roots of Scrum
sanogemaru
3
960
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
30k
「魔法少女まどか☆マギカ Magia Exedra」のグローバル展開を支える、開発チームと翻訳チームの「意識しない協創」を実現するローカライズシステム
gree_tech
PRO
0
560
ヘブンバーンズレッドにおける、世界観を活かしたミニゲーム企画の作り方
gree_tech
PRO
0
550
Skrub: machine-learning with dataframes
gaelvaroquaux
0
120
Agile PBL at New Grads Trainings
kawaguti
PRO
1
300
なぜSaaSがMCPサーバーをサービス提供するのか?
sansantech
PRO
8
2.5k
Featured
See All Featured
Bash Introduction
62gerente
615
210k
For a Future-Friendly Web
brad_frost
180
9.9k
How to Ace a Technical Interview
jacobian
279
23k
How to train your dragon (web standard)
notwaldorf
96
6.2k
Embracing the Ebb and Flow
colly
87
4.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
Designing for Performance
lara
610
69k
A Tale of Four Properties
chriscoyier
160
23k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
131
19k
Unsuck your backbone
ammeep
671
58k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
111
20k
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