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
An Introduction to Snapshot testing
Search
Freek Van der Herten
September 01, 2021
Technology
600
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
An Introduction to Snapshot testing
Freek Van der Herten
September 01, 2021
More Decks by Freek Van der Herten
See All by Freek Van der Herten
Uncharted packages (ode aan de code)
freekmurze
0
77
Uncharted packages (Laravel Live Denmark)
freekmurze
0
270
I shall define this only once
freekmurze
0
500
Event Sourcing In Laravel
freekmurze
0
300
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
900
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
950
A practical look at multitenancy in Laravel
freekmurze
1
420
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
810
Highlights Flare codebase (Laracon online)
freekmurze
0
610
Other Decks in Technology
See All in Technology
macOS Golden Gate 時代のMac管理
tategami
0
110
20261017福岡devIO 「AIは"良いダッシュボード"を作れるか?
jtakeda
0
220
How to Design Configuration for Rails Applications
willnet
1
1.1k
小規模OSSモデルは サイバーセキュリティ業務に どこまで使えるか
bbrbbq
0
160
DevelopersIO2026 -バックアップは“消されないこと”が9割-
yoshida0129
0
230
AIをリアル世界に解き放つ 〜M5Stack×AIであなたのアイディアを手の平に〜
hamadakoji
1
200
DGX Spark でどこまでハッキングができるのか?
kash1064
3
1.4k
Claude Code on Bedrock で統制をかける小ネタ集/claude-code-bedrock-governance-tips
emiki
1
130
What Is JetBrains Air
x5gtrn
PRO
0
130
野蛮なアジャイル [サイボウズ発!]組織の常識を覆した反骨のスクラム実践記 / Barbaric Agile - Enterprise Agile Study Group
ama_ch
0
120
オントロジーって 結局なにもの? AI エージェントに「意味」を渡す知識設計の話
greenmidori
0
250
AIネイティブ企業への変革。パーソルキャリアが挑む「データメッシュ×ガバナンス」のアーキテクチャ戦略
techtekt
PRO
0
120
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
529
40k
Typedesign – Prime Four
hannesfritz
42
3.2k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
870
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Navigating Weather and Climate Data
rabernat
0
560
Amusing Abliteration
ianozsvald
1
350
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
350
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Mobile First: as difficult as doing things right
swwweet
225
10k
Transcript
AN INTRODUCTION TO SNAPSHOT TESTING Freek Van der Herten
About me Freek Van der Herten Developer at SPATIE @freekmurze
freek.dev spatie.be/products ohdear.app
spatie.be/open-source 300+ open source packages PHP & Laravel 175 million
downloads total 9 million downloads per month
LET’S TALK ABOUT SNAPSHOT TESTING
What? A file on disk – let’s call it a
snapshot Test succeeds if the output matches the snapshot If not, the test will fail
Where does it come from? Characterisation testing Popularized by Facebook
Jest Testing interfaces
How can we do it in PHP? github.com/spatie/phpunit-snapshot-assertions github.com/spatie/pest-plugin-snapshots assertMatchesSnapshot
assertMatchesJsonSnapshot assertMatchesXmlSnapshot
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
Interesting links github.com/spatie/phpunit-snapshot-assertions github.com/spatie/pest-plugin-snapshots github.com/spatie/shiki-php github.com/spatie/laravel-markdown torchlight.dev
ONE MORE THING
testing-laravel.com Premium video course, 6+ hours of video Learn how
to tests a Laravel app from scratch Tips and tricks to sharpen your skills Two courses in one: Pest & PHPUnit 10 % discount with SPATIE-LOVES-LARACON
Thank you! spatie.be spatie.be/products spatie.be/open-source testing-laravel.com freek.dev