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
snapshot testing (laraconus)
Search
Freek Van der Herten
July 25, 2017
Programming
0
120
snapshot testing (laraconus)
Freek Van der Herten
July 25, 2017
Tweet
Share
More Decks by Freek Van der Herten
See All by Freek Van der Herten
Uncharted packages (ode aan de code)
freekmurze
0
30
Uncharted packages (Laravel Live Denmark)
freekmurze
0
220
I shall define this only once
freekmurze
0
440
An Introduction to Snapshot testing
freekmurze
0
510
Event Sourcing In Laravel
freekmurze
0
260
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
830
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
870
A practical look at multitenancy in Laravel
freekmurze
1
370
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
750
Other Decks in Programming
See All in Programming
FlutterKaigi 2025 システム裏側
yumnumm
0
750
Private APIの呼び出し方
kishikawakatsumi
2
830
Eloquentを使ってどこまでコードの治安を保てるのか?を新人が考察してみた
itokoh0405
0
3.1k
複数チーム並行開発下でのコード移行アプローチ ~手動 Codemod から「生成AI 活用」への進化
andpad
0
140
CloudflareのSandbox SDKを試してみた
syumai
0
130
Swift Concurrency 年表クイズ
omochi
3
230
Dive into Triton Internals
appleparan
0
480
乱雑なコードの整理から学ぶ設計の初歩
masuda220
PRO
28
8.4k
The Missing Link in Angular's Signal Story: Resource API and httpResource
manfredsteyer
PRO
0
110
Claude Code on the Web を超える!? Codex Cloud の実践テク5選
sunagaku
0
490
外接に惑わされない自システムの処理時間SLIをOpenTelemetryで実現した話
kotaro7750
0
240
問題の見方を変える「システム思考」超入門
panda_program
0
190
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
340
57k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
118
20k
How GitHub (no longer) Works
holman
315
140k
Statistics for Hackers
jakevdp
799
220k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.7k
Speed Design
sergeychernyshev
32
1.2k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Building a Scalable Design System with Sketch
lauravandoore
463
33k
Transcript
A practical intro to snapshot testing
Pronouncing Dutch Michael 3/10 Jacob 1/10
Pronouncing Dutch Michael 9/10 Jacob 9/10
Drake
Frake
Pronouncing Dutch: Spatie Spa Sea
LET’S TALK SNAPSHOT TESTING
A file on disk, let’s call in snapshot Test succeeds
if output matches snapshot If not, test will fail What?
Old name: characterization testing Popularized by Facebook Jest Testing interfaces
Where does it come from?
https://github.com/spatie/phpunit-snapshot-assertions assertMatchesSnapshot assertMatchesJsonSnapshot assertMatchesXmlSnapshot How can we do it in
PHP?
DEMO
WRAPPING UP
Advantages Very easy to get started with Can be used
to validate complex output Easily update all the tests in one go
Disadvantages Brittle Hard to pinpoint exact point of failure Bugs
can be easily written in the snapshots
https://github.com/spatie/phpunit-snapshot-assertions https://sebastiandedeyne.com/posts/2017/a-package-for-snapshot- testing-in-phpunit https://murze.be/2017/04/practical-introduction-snapshot-testing/ https://www.sitepoint.com/snapshot-testing-viable-php/ https://facebook.github.io/jest/docs/snapshot-testing.html Interesting links
Thank you! https://speakerdeck.com/freekmurze/snapshot-testing-laraconus https://spatie.be/opensource https://murze.be https://murze.be/newsletter/
QUESTIONS?