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
0
160
Snapshot testing (dpc)
Freek Van der Herten
June 30, 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
53
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
280
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
770
Other Decks in Technology
See All in Technology
モダンUIでフルサーバーレスなAIエージェントをAmplifyとCDKでサクッとデプロイしよう
minorun365
5
270
Cloud Runでコロプラが挑む 生成AI×ゲーム『神魔狩りのツクヨミ』の裏側
colopl
0
280
配列に見る bash と zsh の違い
kazzpapa3
3
190
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
94k
ZOZO.swift #2
zozotech
PRO
0
230
AWS Network Firewall Proxyを触ってみた
nagisa53
1
260
AIエージェントを開発しよう!-AgentCore活用の勘所-
yukiogawa
0
220
StrandsAgentsで構築したAIエージェントにMCP Apps機能を追加してみた
kmiya84377
0
130
日本の85%が使う公共SaaSは、どう育ったのか
taketakekaho
1
280
Oracle Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
3
610
チーム開発の基礎_研究を事業につなげるために
cyberagentdevelopers
PRO
2
990
なぜAIは チーム開発を 速くしないのか
tan_go238
6
2.4k
Featured
See All Featured
Accessibility Awareness
sabderemane
0
63
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
450
A Modern Web Designer's Workflow
chriscoyier
698
190k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Site-Speed That Sticks
csswizardry
13
1.1k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
170
Automating Front-end Workflow
addyosmani
1371
200k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
460
Become a Pro
speakerdeck
PRO
31
5.8k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
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/