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 (phplimburg)
Search
Freek Van der Herten
September 07, 2017
Programming
1
370
snapshot testing (phplimburg)
Freek Van der Herten
September 07, 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
47
Uncharted packages (Laravel Live Denmark)
freekmurze
0
240
I shall define this only once
freekmurze
0
460
An Introduction to Snapshot testing
freekmurze
0
530
Event Sourcing In Laravel
freekmurze
0
270
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
850
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
890
A practical look at multitenancy in Laravel
freekmurze
1
390
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
760
Other Decks in Programming
See All in Programming
AI 駆動開発ライフサイクル(AI-DLC):ソフトウェアエンジニアリングの再構築 / AI-DLC Introduction
kanamasa
11
5.5k
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
340
AI Agent Dojo #4: watsonx Orchestrate ADK体験
oniak3ibm
PRO
0
130
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2k
從冷知識到漏洞,你不懂的 Web,駭客懂 - Huli @ WebConf Taiwan 2025
aszx87410
2
3.4k
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
250
.NET Conf 2025 の興味のあるセッ ションを復習した / dotnet conf 2025 quick recap for backend engineer
tomohisa
0
110
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
770
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
2.2k
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
360
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
270
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
450
Featured
See All Featured
Deep Space Network (abreviated)
tonyrice
0
34
Scaling GitHub
holman
464
140k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
99
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
610
Into the Great Unknown - MozCon
thekraken
40
2.2k
Between Models and Reality
mayunak
1
170
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
220
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.2k
4 Signs Your Business is Dying
shpigford
187
22k
Context Engineering - Making Every Token Count
addyosmani
9
610
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Transcript
A practical intro to snapshot testing and PHPUnit-watcher
About me Freek Van der Herten Partner & developer at
SPATIE Blogging at https://murze.be https://murze.be/newsletter
OPEN SOURCE SOFTWARE
https://spatie.be/en/opensource/laravel
Open source software ± 160 public repositories on GitHub August
2016: ± 800 000 downloads August 2017: ± 5 000 000 downloads ± 500 000 downloads a month
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?
Another 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 https://github.com/spatie/phpunit-watcher Interesting links
Thank you! https://speakerdeck.com/freekmurze/snapshot-testing-phplimburg https://spatie.be/opensource https://murze.be https://murze.be/newsletter/
QUESTIONS?