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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Brian Gardner
August 27, 2018
Technology
94
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
農家は秘伝のタレを知らない - NOBODY KNOWS THE HIDDEN SOURCE - Kaggriculture 3rd Place Solution
masspeaks
2
500
Re:ゼロから始めるシェアハウスのペットな鯖
silmin_
0
230
AWS基盤改善を支える 私たちの理念と行動指針
kentosuzuki
0
240
人間+AIを「チーム」としてプロセスを再設計する
littlehands
4
3.4k
[関西Kaggler会 20261113] 続・コミュニティコンペのススメ
nejumi
0
130
2026-11-16 JAWS-UG コンテナ支部 #31 ゆるLT大会 ECR のライフサイクルポリシーを いい感じに設定したい / ECR Lifecycle policy
masasuzu
2
380
目を覚ませ!僕らの認証情報が何者かに侵略されてるぞ
tkito
2
440
小さなエージェントから始めてみよう!実践コンテキストエンジニアリング
iwamot
PRO
0
130
Del vibe coding a un Desarrollo (agéntico) fiable
jcabot
0
140
Frontier Teams — Amazon は AI で「開発のやり方」をどう変えたのか
kmotohas
0
290
WasmをRustにする技術
sansantech
PRO
0
110
3文字略語に騙されない! 世界一わかりやすい『EDR』超入門
kamadamakoto
1
230
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
247
13k
We Are The Robots
honzajavorek
0
450
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
620
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
660
Exploring anti-patterns in Rails
aemeredith
4
570
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
990
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
750
Are puppies a ranking factor?
jonoalderson
2
4.2k
Prompt Engineering for Job Search
mfonobong
0
590
The untapped power of vector embeddings
frankvandijk
2
2k
Amusing Abliteration
ianozsvald
1
390
Paper Plane
katiecoart
PRO
6
55k