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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Brian Gardner
August 27, 2018
Technology
74
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
More Decks by Brian Gardner
See All by Brian Gardner
GoogleMap DroidCon SF 23
briangardnerdev
0
2.4k
Mocks and Stubs and Spies, oh my!
briangardnerdev
1
230
Take a stab at test friendly architecture
briangardnerdev
1
160
Other Decks in Technology
See All in Technology
MCP Appsを作ってみよう
iwamot
PRO
4
540
Android の公式 Skill / Android skills
yanzm
0
130
連合学習と機密コンピューティング
lycorptech_jp
PRO
0
100
AWSシリコン最前線 〜AI時代のチップ選択を読み解く〜
htokoyo
2
460
小さくはじめるSLI/SLO ~育てながら組織に定着させる実践知~ / Starting Small with SLI/SLOs: Building Adoption Through Continuous Growth
nari_ex
5
1.7k
Dario Amodi『Policy on the AI Exponential』を理解する
nagatsu
0
220
攻撃者視点で考えるDetection Engineering
cryptopeg
1
1.2k
白金鉱業Meetup_Vol.24_「AIエージェントは分けるほど良い」は本当か? / Is it true that “the more you divide AI agents, the better”?
brainpadpr
1
300
Claude Codeをどのように キャッチアップしているか
oikon48
6
4.1k
AGENTS.mdとSkillsで始めるAIエージェント活用
sonoda_mj
3
200
フロンティアAIのゲート化と地政学リスク
nagatsu
0
120
脆弱性対応、どこで線を引くか
rymiyamoto
0
370
Featured
See All Featured
Building Adaptive Systems
keathley
44
3k
The Invisible Side of Design
smashingmag
302
52k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
Deep Space Network (abreviated)
tonyrice
0
170
The Curious Case for Waylosing
cassininazir
1
380
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Done Done
chrislema
186
16k
Scaling GitHub
holman
464
140k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
320
Are puppies a ranking factor?
jonoalderson
1
3.5k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
440
Discover your Explorer Soul
emna__ayadi
2
1.1k
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