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
Freek Van der Herten
July 25, 2017
Programming
0
120
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 (Laravel Live Denmark)
freekmurze
0
210
I shall define this only once
freekmurze
0
410
An Introduction to Snapshot testing
freekmurze
0
500
Event Sourcing In Laravel
freekmurze
0
250
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
820
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
860
A practical look at multitenancy in Laravel
freekmurze
1
360
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
730
Highlights Flare codebase (Laracon online)
freekmurze
0
520
Other Decks in Programming
See All in Programming
KessokuでDIでもgoroutineを活用する / Go Connect #6
mazrean
0
120
TanStack DB ~状態管理の新しい考え方~
bmthd
2
340
私の後悔をAWS DMSで解決した話
hiramax
4
140
あのころの iPod を どうにか再生させたい
orumin
2
2.5k
decksh - a little language for decks
ajstarks
4
21k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
180
MCPで実現するAIエージェント駆動のNext.jsアプリデバッグ手法
nyatinte
7
890
令和最新版手のひらコンピュータ
koba789
14
8k
パスタの技術
yusukebe
1
400
Oracle Database Technology Night 92 Database Connection control FAN-AC
oracle4engineer
PRO
1
220
🔨 小さなビルドシステムを作る
momeemt
2
530
実践!App Intents対応
yuukiw00w
1
350
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
351
21k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
1k
Designing for Performance
lara
610
69k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
Writing Fast Ruby
sferik
628
62k
Navigating Team Friction
lara
189
15k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
Side Projects
sachag
455
43k
The Straight Up "How To Draw Better" Workshop
denniskardys
236
140k
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?