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
100
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
180
I shall define this only once
freekmurze
0
380
An Introduction to Snapshot testing
freekmurze
0
460
Event Sourcing In Laravel
freekmurze
0
230
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
770
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
820
A practical look at multitenancy in Laravel
freekmurze
1
330
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
700
Highlights Flare codebase (Laracon online)
freekmurze
0
460
Other Decks in Programming
See All in Programming
Expoによるアプリ開発の現在地とReact Server Componentsが切り開く未来
yukukotani
1
200
DRFを少しずつ オニオンアーキテクチャに寄せていく DjangoCongress JP 2025
nealle
2
290
クックパッド検索システム統合/Cookpad Search System Consolidation
giga811
0
130
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
1.1k
SwiftUI移行のためのインプレッショントラッキング基盤の構築
kokihirokawa
0
170
ML.NETで始める機械学習
ymd65536
0
240
「個人開発マネタイズ大全」が教えてくれたこと
bani24884
1
290
Learning Kotlin with detekt
inouehi
1
190
ナレッジイネイブリングにAIを活用してみる ゆるSRE勉強会 #9
nealle
0
170
Swift Testingのモチベを上げたい
stoticdev
2
190
CSS Linter による Baseline サポートの仕組み
ryo_manba
1
160
DevNexus - Create AI Infused Java Apps with LangChain4j
kdubois
0
130
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
440
Visualization
eitanlees
146
15k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
30
4.6k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
21
2.5k
The World Runs on Bad Software
bkeepers
PRO
67
11k
Speed Design
sergeychernyshev
27
810
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
GitHub's CSS Performance
jonrohan
1030
460k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1.1k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
580
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?