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 (dpc)
Search
Freek Van der Herten
June 30, 2017
Technology
160
0
Share
Snapshot testing (dpc)
Freek Van der Herten
June 30, 2017
More Decks by Freek Van der Herten
See All by Freek Van der Herten
Uncharted packages (ode aan de code)
freekmurze
0
66
Uncharted packages (Laravel Live Denmark)
freekmurze
0
260
I shall define this only once
freekmurze
0
480
An Introduction to Snapshot testing
freekmurze
0
570
Event Sourcing In Laravel
freekmurze
0
280
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
880
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
920
A practical look at multitenancy in Laravel
freekmurze
1
400
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
790
Other Decks in Technology
See All in Technology
イベントで大活躍する電子ペーパー名札 〜その3〜 / ビジュアルプログラミングIoTLT vol.23
you
PRO
0
150
Kaggle未経験社員をメダリストに育てる「AIドラゴン桜」
lycorptech_jp
PRO
0
610
責任あるソフトウェアエンジニアリングの紹介4章・5章 / RSE_Ch4-5
ido_kara_deru
0
340
食べログのサーキットブレーカー導入を振り返って
atpons
0
130
Strands Agents超入門
kintotechdev
1
110
TSKaigi 2026 - enumよ、さようなら
teamlab
PRO
3
560
layerx-fde-practices
cipepser
6
2.7k
OpenClawとHermesAgentでAI新入社員を作った話
takanoriyanada
0
110
AI時代の私の技術インプットとアウトプット術
tonkotsuboy_com
12
6.8k
テストコードのないプロジェクトにテストを根付かせる
tttol
0
180
はじめてのAI-DLC
yoshidashingo
2
570
TROCCOで始めるクラウドコストを民主化するためのFinOps
tk3fftk
1
180
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Designing for Performance
lara
611
70k
Tell your own story through comics
letsgokoyo
1
930
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.1k
New Earth Scene 8
popppiees
3
2.3k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
190
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1.1k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Music & Morning Musume
bryan
47
7.2k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
420
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
710
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.7k
Transcript
A practical intro to snapshot testing
About me Freek Van der Herten Partner & developer at
SPATIE @freekmurze https://murze.be
About me phpantwerp.be Dries Vints @driesvints Frederick Vanbrabant @TheEdonian
Since 2003 Websites, applications and webshops Team 4 developers, 1
manager Specialization Laravel development
OPEN SOURCE SOFTWARE
± 120 packages on Packagist Laravel, Framework agnostic PHP ±
4 000 000 downloads in total, growing ±450 000 a month We create a lot of it Open source software
http://github-awards.com/users?type=world&language=php Open source software
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
QUESTIONS?
Thank you! https://speakerdeck.com/freekmurze/snapshot-testing-dpc https://spatie.be/opensource https://murze.be https://murze.be/newsletter/