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 (laraconus)
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Freek Van der Herten
July 25, 2017
Programming
0
130
snapshot testing (laraconus)
Freek Van der Herten
July 25, 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
60
Uncharted packages (Laravel Live Denmark)
freekmurze
0
250
I shall define this only once
freekmurze
0
470
An Introduction to Snapshot testing
freekmurze
0
550
Event Sourcing In Laravel
freekmurze
0
280
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
860
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
900
A practical look at multitenancy in Laravel
freekmurze
1
400
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
780
Other Decks in Programming
See All in Programming
Nuxt Server Components
wattanx
0
150
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
240
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
170
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
180
それはエンジニアリングの糧である:AI開発のためにAIのOSSを開発する現場より / It serves as fuel for engineering: insights from the field of developing open-source AI for AI development.
nrslib
1
620
へんな働き方
yusukebe
6
2.9k
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
160
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
850
Mastering Event Sourcing: Your Parents Holidayed in Yugoslavia
super_marek
0
120
Fundamentals of Software Engineering In the Age of AI
therealdanvega
2
300
PHPで TLSのプロトコルを実装してみる
higaki_program
0
530
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
16
3.4k
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
For a Future-Friendly Web
brad_frost
183
10k
How to Talk to Developers About Accessibility
jct
2
160
BBQ
matthewcrist
89
10k
Balancing Empowerment & Direction
lara
5
1k
Agile that works and the tools we love
rasmusluckow
331
21k
Writing Fast Ruby
sferik
630
63k
New Earth Scene 8
popppiees
1
1.9k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
250
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
260
Build your cross-platform service in a week with App Engine
jlugia
234
18k
The Spectacular Lies of Maps
axbom
PRO
1
650
Transcript
A practical intro to snapshot testing
Pronouncing Dutch Michael 3/10 Jacob 1/10
Pronouncing Dutch Michael 9/10 Jacob 9/10
Drake
Frake
Pronouncing Dutch: Spatie Spa Sea
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-laraconus https://spatie.be/opensource https://murze.be https://murze.be/newsletter/
QUESTIONS?