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
100
0
Share
3 Steps Every Test Should Take
Matheus Richard
May 27, 2021
More Decks by Matheus Richard
See All by Matheus Richard
The Fast Lane: Asynchronous Rails
matheusrich
0
59
Build in Private
matheusrich
0
73
Start TDDing in 5 minutes
matheusrich
0
120
Taming God Objects: easy, incremental and secure
matheusrich
1
120
Stimulus 2.0-alpha - What's new?
matheusrich
0
53
BEM - A simple CSS methodology
matheusrich
0
53
De Repente 7
matheusrich
0
19
Other Decks in Programming
See All in Programming
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
190
t *testing.T は どこからやってくるの?
otakakot
1
680
CursorとClaudeCodeとCodexとOpenCodeを実際に比較してみた
terisuke
1
470
Coding at the Speed of Thought: The New Era of Symfony Docker
dunglas
0
5k
今こそ押さえておきたい アマゾンウェブサービス(AWS)の データベースの基礎 おもクラ #6版
satoshi256kbyte
1
250
〜バイブコーディングを超えて〜 チームで実験し続けたAI駆動開発
tigertora7571
0
110
事業会社でのセキュリティ長期インターンについて
masachikaura
0
250
2026_04_15_量子計算をパズルとして解く
hideakitakechi
0
110
書籍「ユーザーストーリーマッピング」が私のバイブル
asumikam
4
370
How Swift's Type System Guides AI Agents
koher
0
270
Agentic Elixir
whatyouhide
0
320
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
430
Featured
See All Featured
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.2k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
150
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.4k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
Ethics towards AI in product and experience design
skipperchong
2
260
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
730
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
27
3.4k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
64
54k
Speed Design
sergeychernyshev
33
1.6k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
190
Code Review Best Practice
trishagee
74
20k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.4k
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