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
200
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
810
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
850
A practical look at multitenancy in Laravel
freekmurze
1
350
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
730
Highlights Flare codebase (Laracon online)
freekmurze
0
510
Other Decks in Programming
See All in Programming
QA x AIエコシステム段階構築作戦
osu
0
210
Google I/O Extended Incheon 2025 ~ What's new in Android development tools
pluu
1
200
React は次の10年を生き残れるか:3つのトレンドから考える
oukayuka
40
15k
AIに安心して任せるためにTypeScriptで一意な型を作ろう
arfes0e2b3c
0
270
DMMを支える決済基盤の技術的負債にどう立ち向かうか / Addressing Technical Debt in Payment Infrastructure
yoshiyoshifujii
4
650
ご注文の差分はこちらですか? 〜 AWS CDK のいろいろな差分検出と安全なデプロイ
konokenj
4
710
知って得する@cloudflare_vite-pluginのあれこれ
chimame
1
120
AIともっと楽するE2Eテスト
myohei
9
3.2k
Vibe Codingの幻想を超えて-生成AIを現場で使えるようにするまでの泥臭い話.ai
fumiyakume
18
9.5k
中級グラフィックス入門~効率的なメッシュレット描画~
projectasura
3
1.7k
JetBrainsのAI機能の紹介 #jjug
yusuke
0
110
MySQL9でベクトルカラム登場!PHP×AWSでのAI/類似検索はこう変わる
suguruooki
1
250
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Why Our Code Smells
bkeepers
PRO
337
57k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
Music & Morning Musume
bryan
46
6.7k
Optimizing for Happiness
mojombo
379
70k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
Embracing the Ebb and Flow
colly
86
4.8k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Making Projects Easy
brettharned
117
6.3k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
Practical Orchestrator
shlominoach
189
11k
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?