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
3 Steps Every Test Should Take
Search
Matheus Richard
May 27, 2021
Programming
0
96
3 Steps Every Test Should Take
Matheus Richard
May 27, 2021
Tweet
Share
More Decks by Matheus Richard
See All by Matheus Richard
The Fast Lane: Asynchronous Rails
matheusrich
0
49
Build in Private
matheusrich
0
71
Start TDDing in 5 minutes
matheusrich
0
110
Taming God Objects: easy, incremental and secure
matheusrich
1
110
Stimulus 2.0-alpha - What's new?
matheusrich
0
51
BEM - A simple CSS methodology
matheusrich
0
51
De Repente 7
matheusrich
0
17
Other Decks in Programming
See All in Programming
2026年 エンジニアリング自己学習法
yumechi
0
140
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
21
7.2k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
580
dchart: charts from deck markup
ajstarks
3
990
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
280
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
5
460
Apache Iceberg V3 and migration to V3
tomtanaka
0
160
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
390
Implementation Patterns
denyspoltorak
0
290
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
170
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
5
720
Oxlint JS plugins
kazupon
1
960
Featured
See All Featured
Ruling the World: When Life Gets Gamed
codingconduct
0
140
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.5k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
120
Odyssey Design
rkendrick25
PRO
1
500
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.2k
Designing Powerful Visuals for Engaging Learning
tmiket
0
230
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.4k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
290
Designing Experiences People Love
moore
144
24k
sira's awesome portfolio website redesign presentation
elsirapls
0
150
Unsuck your backbone
ammeep
671
58k
Transcript
3 Steps Every Test Should Take
About me Matheus Richard
This is a ⚡lightning talk⚡, so I’m gonna go FAST
💨
🧪 Tests
😄 Tests are good! They make us more productive. Right?
❌ WRONG!
✔Good tests are good
🐢 Poorly written tests slow us down!
Developer happiness-meter: 🙁 🐌 Slow tests
Developer happiness-meter: 😞 🤔 Confusing tests 🐌 Slow tests
Flaky tests Developer happiness-meter: 😠 🤔 Confusing tests 🐌
Slow tests
Flaky tests Developer happiness-meter: 🤬 🤔 Confusing tests 📦
Brittle tests 🐌 Slow tests
🐌 Slow tests Flaky tests 📦 Brittle tests 🤔
Confusing tests
Good tests tell a story
The story has 4 acts
📝 1. Setup
📝 1. Setup Create objects Define function inputs
📝 1. Setup 🏋 2. Exercise
📝 1. Setup 🏋 2. Exercise Calling methods Saving objects
to DB
📝 1. Setup 🏋 2. Exercise 3. Verify
📝 1. Setup 🏋 2. Exercise 3. Verify Check
if the output is the expected
📝 1. Setup 3. Verify 🏋 2. Exercise 💥
4. Teardown
📝 1. Setup 3. Verify 🏋 2. Exercise 💥
4. Teardown Undo changes Release memory Restore DB
📝 1. Setup 🏋 2. Exercise 3. Verify 💥
4. Teardown You’re welcome!
📝 1. Setup 3. Verify 🏋 2. Exercise
📝 1. Arrange 3. Assert 🏋 2. Act aka
📝 1. Given 3. Then 🏋 2. When aka
None
None
None
🤨 Why is this good?
Consistency
None
None
None
None
E X E R C I S E
Tests are self-contained. No mystery guests here
None
1. Verify Developer confusion-meter: 🤔❓
1. Verify 2. Exercise + Setup Developer confusion-meter: 🥴⁉
1. Verify 2. Exercise + Setup? 3. Verify Developer confusion-meter:
😵
Developer confusion-meter: 😵
Developer happiness-meter: 🥰
SPACE IS IMPORTANT Developer happiness-meter: 🥰
Developer happiness-meter: 😐
Developer happiness-meter: 🥰
Good tests have 4 3 steps
📝 1. Setup
📝 1. Setup 🏋 2. Exercise
📝 1. Setup 3. Verify 🏋 2. Exercise
We need not only tests, but good tests!
We want good code and tests are code too!
That’s it Feel free to ask any question