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
76
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
Claude Code 珍プレー好プレー
shinyasaita
0
200
AIに「使われる」時代のSaaS戦略 〜既存WebAPIのMCPサーバー化における開発ノウハウ〜
ekispert_api
0
290
背中から、背中へ /paying forward to community
naitosatoshi
0
220
AI時代における最適なQA組織の作り方
ymty
3
370
記録をかんたんに、提案をパーソナルに ── AIであすけんが目指すもの
oprstchn
0
140
インフラ寄りSREでも 開発に踏み出せる〜境界を越えてユーザー体験に向き合いたい〜
sansantech
PRO
0
490
AIDLC_ヤフーショッピングの取り組み
lycorptech_jp
PRO
0
520
SRE歴2ヶ月でも開発6年の知見を活かして、チームで止まっていた環境改善を前に進めた話
a_ono
1
200
「ちゃんとやっている」は独りよがりだった ― 不安に寄り添うインシデント対応へ / Towards incident response that addresses anxieties
chmikata
1
530
金融の未来を考える / Thinking About the Future of Finance
ks91
PRO
0
150
AI Agentをシステムに組み込む前にゆるく向き合ってみる
hayama17
0
200
AIに障害切り分けを全部やってもらった。 。 。 。
estie
0
360
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
A better future with KSS
kneath
240
18k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
The Curse of the Amulet
leimatthew05
2
13k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
Utilizing Notion as your number one productivity tool
mfonobong
4
340
Marketing to machines
jonoalderson
1
5.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Designing Experiences People Love
moore
143
24k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Visualization
eitanlees
152
17k
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