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
64
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
160
Other Decks in Technology
See All in Technology
Riverpod3.xで実現する実践的UI実装
fumiyasac0921
2
340
持続可能な開発のためのミニマリズム
sansantech
PRO
4
590
GitHub Copilot CLI 現状確認会議
torumakabe
12
4.9k
Regional_NAT_Gatewayについて_basicとの違い_試した内容スケールアウト_インについて_IPv6_dual_networkでの使い分けなど.pdf
cloudevcode
1
160
フロントエンド開発者のための「厄払い」
optim
0
170
OCI技術資料 : OS管理ハブ 概要
ocise
2
4.3k
SREの仕事を自動化する際にやっておきたい5つのポイント
jacopen
6
1.1k
DEVCON 14 Report at AAMSX RU65: V9968, MSX0tab5, MSXDIY etc
mcd500
0
230
AI時代にあわせたQA組織戦略
masamiyajiri
6
2.7k
AI推進者の視点で見る、Bill OneのAI活用の今
sansantech
PRO
1
130
【インシデント入門】サイバー攻撃を受けた現場って何してるの?
shumei_ito
0
450
AIとともに歩む情報セキュリティ / Information Security with AI
kanny
4
2.5k
Featured
See All Featured
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
160
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.9k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Testing 201, or: Great Expectations
jmmastey
46
8k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
0
1.8k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
52k
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