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
370
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
760
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
2024年のkintone API振り返りと2025年 / kintone API look back in 2024
tasshi
0
220
Compose でデザインと実装の差異を減らすための取り組み
oidy
1
310
『テスト書いた方が開発が早いじゃん』を解き明かす #phpcon_nagoya
o0h
PRO
2
200
チームリードになって変わったこと
isaka1022
0
200
第3回 Snowflake 中部ユーザ会- dbt × Snowflake ハンズオン
hoto17296
4
370
Unity Android XR入門
sakutama_11
0
160
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
370
Java Webフレームワークの現状 / java web framework at burikaigi
kishida
9
2.2k
技術を根付かせる / How to make technology take root
kubode
1
250
パスキーのすべて ── 導入・UX設計・実装の紹介 / 20250213 パスキー開発者の集い
kuralab
3
780
『GO』アプリ データ基盤のログ収集システムコスト削減
mot_techtalk
0
120
クリーンアーキテクチャから見る依存の向きの大切さ
shimabox
1
230
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
137
6.8k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
174
51k
Code Reviewing Like a Champion
maltzj
521
39k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.7k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
Building a Scalable Design System with Sketch
lauravandoore
461
33k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Documentation Writing (for coders)
carmenintech
67
4.6k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Unsuck your backbone
ammeep
669
57k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
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?