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
3 Steps Every Test Should Take
Search
Matheus Richard
May 27, 2021
Programming
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
3 Steps Every Test Should Take
Matheus Richard
May 27, 2021
Transcript
54 slides
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
More Decks by Matheus Richard
See All by Matheus Richard
The Fast Lane: Asynchronous Rails
matheusrich
0
82
Build in Private
matheusrich
0
77
Start TDDing in 5 minutes
matheusrich
0
130
Taming God Objects: easy, incremental and secure
matheusrich
1
140
Stimulus 2.0-alpha - What's new?
matheusrich
0
60
BEM - A simple CSS methodology
matheusrich
0
59
De Repente 7
matheusrich
0
24
Other Decks in Programming
See All in Programming
高速開発を止めずに 性能を上げる Flyleのシステム刷新と改善の歴史
azihsoyn
0
100
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
15
12k
エラーチャンネルのボールを拾い続けて鍛えるエンジニアの地力 / phpcon-niigata2026
meihei3
1
500
なぜ私たちは「現時点では」KMPの導入を見送ったのか
chigichan24
1
630
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
340
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
700
クラウドエージェントは、 何がそんなに便利なのか / what makes cloud agents so useful
rkaga
5
980
読みやすい!と評判(?)の発表の準備にかける私のこだわり
shoheimitani
0
160
AIエージェントの「テストは通るのに本番で壊れる」を減らす
shibuiwilliam
3
120
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
260
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
270
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.6k
Featured
See All Featured
Deep Space Network (abreviated)
tonyrice
0
430
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
830
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Faster Mobile Websites
deanohume
310
32k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.6k
Are puppies a ranking factor?
jonoalderson
2
4.2k
Designing for Timeless Needs
cassininazir
1
570
YesSQL, Process and Tooling at Scale
rocio
174
15k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3.1k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
4
1.3k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k