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
Snapshot testing (nomadphp)
Search
Freek Van der Herten
July 20, 2017
Technology
180
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Snapshot testing (nomadphp)
Freek Van der Herten
July 20, 2017
More Decks by Freek Van der Herten
See All by Freek Van der Herten
Uncharted packages (ode aan de code)
freekmurze
0
75
Uncharted packages (Laravel Live Denmark)
freekmurze
0
270
I shall define this only once
freekmurze
0
490
An Introduction to Snapshot testing
freekmurze
0
600
Event Sourcing In Laravel
freekmurze
0
290
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
900
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
940
A practical look at multitenancy in Laravel
freekmurze
1
410
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
810
Other Decks in Technology
See All in Technology
メルカリにおけるAI時代の高速プロトタイピング基盤「Arca」
ryotarai
17
13k
なぜ「決定性」が 決定的に重要なのか? Durable Execution 基盤の数理的理解 #serverlessjp / ServerlessDays Tokyo 2026
ytaka23
4
1.3k
VS Code × GitHub Copilot での Fabric 開発
ryomaru0825
1
110
ScotSecure West 2026 - Glasgow
raybugg
0
190
雪かき部 #7 もう怖くない!SELECT文!
foursue
0
130
地方移住と都心キャリアの両立は「金・時間・人」のリソースをフル活用すれば実現できる!〜Snowflake女子会 vol.8
snowwmn0824
0
130
猫でもわかるKiro Web
kentapapa
1
140
EventBridge に「合流」はない ― サーバーレスのワークフローを育てるということ / No Join in EventBridge
yusukeshimizu
2
600
spanner-autoscalerに学ぶ CRD設計パターン 〜自動化と緊急時対応を両立する Kubernetesコントローラーの作り方〜
tkuchiki
0
200
10年欲しかった音楽管理アプリを、AIと一緒に作りはじめた
judau
1
170
.NET WebAssemblyで実現するクライアントサイドAI推論:NuGetからViteまで、2つのエコシステムを繋ぐビルド戦略
yamachu
1
1k
HacobuにおけるFDEとは/登壇資料(戸井田 裕貴)
hacobu
PRO
1
150
Featured
See All Featured
Unsuck your backbone
ammeep
672
58k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
450
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Fireside Chat
paigeccino
43
4k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
390
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Faster Mobile Websites
deanohume
310
32k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
470
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
490
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 ±500 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
Thank you! https://speakerdeck.com/freekmurze/snapshot-testing-nomadphp https://spatie.be/opensource https://murze.be https://murze.be/newsletter/
QUESTIONS?