Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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 (ode aan de code)
freekmurze
0
33
Uncharted packages (Laravel Live Denmark)
freekmurze
0
230
I shall define this only once
freekmurze
0
450
An Introduction to Snapshot testing
freekmurze
0
520
Event Sourcing In Laravel
freekmurze
0
270
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
840
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
880
A practical look at multitenancy in Laravel
freekmurze
1
380
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
750
Other Decks in Programming
See All in Programming
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
410
大体よく分かるscala.collection.immutable.HashMap ~ Compressed Hash-Array Mapped Prefix-tree (CHAMP) ~
matsu_chara
1
200
AIエンジニアリングのご紹介 / Introduction to AI Engineering
rkaga
1
580
CSC305 Lecture 15
javiergs
PRO
0
230
Combinatorial Interview Problems with Backtracking Solutions - From Imperative Procedural Programming to Declarative Functional Programming - Part 1
philipschwarz
PRO
0
120
宅宅自以為的浪漫:跟 AI 一起為自己辦的研討會寫一個售票系統
eddie
0
450
jakarta-security-jjug-ccc-2025-fall
tnagao7
0
110
[堅牢.py #1] テストを書かない研究者に送る、最初にテストを書く実験コード入門 / Let's start your ML project by writing tests
shunk031
11
6.6k
全員アーキテクトで挑む、 巨大で高密度なドメインの紐解き方
agatan
8
18k
AI時代もSEOを頑張っている話
shirahama_x
0
220
sbt 2
xuwei_k
0
160
JJUG CCC 2025 Fall: Virtual Thread Deep Dive
ternbusty
3
510
Featured
See All Featured
Building an army of robots
kneath
306
46k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Writing Fast Ruby
sferik
630
62k
Context Engineering - Making Every Token Count
addyosmani
9
450
The World Runs on Bad Software
bkeepers
PRO
72
12k
How to Ace a Technical Interview
jacobian
280
24k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
A Modern Web Designer's Workflow
chriscoyier
697
190k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
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?