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 (nomadphp)
Search
Freek Van der Herten
July 20, 2017
Technology
0
140
Snapshot testing (nomadphp)
Freek Van der Herten
July 20, 2017
Tweet
Share
More Decks by Freek Van der Herten
See All by Freek Van der Herten
Uncharted packages (Laravel Live Denmark)
freekmurze
0
170
I shall define this only once
freekmurze
0
370
An Introduction to Snapshot testing
freekmurze
0
450
Event Sourcing In Laravel
freekmurze
0
220
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
750
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
810
A practical look at multitenancy in Laravel
freekmurze
1
320
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
690
Highlights Flare codebase (Laracon online)
freekmurze
0
450
Other Decks in Technology
See All in Technology
東京Ruby会議12 Ruby と Rust と私 / Tokyo RubyKaigi 12 Ruby, Rust and me
eagletmt
3
870
2025年のARグラスの潮流
kotauchisunsun
0
790
いま現場PMのあなたが、 経営と向き合うPMになるために 必要なこと、腹をくくること
hiro93n
9
7.6k
Git scrapingで始める継続的なデータ追跡 / Git Scraping
ohbarye
5
490
今から、 今だからこそ始める Terraform で Azure 管理 / Managing Azure with Terraform: The Perfect Time to Start
nnstt1
0
220
Building Scalable Backend Services with Firebase
wisdommatt
0
110
Azureの開発で辛いところ
re3turn
0
240
2025年の挑戦 コーポレートエンジニアの技術広報/techpr5
nishiuma
0
140
30分でわかる「リスクから学ぶKubernetesコンテナセキュリティ」/30min-k8s-container-sec
mochizuki875
3
440
【NGK2025S】動物園(PINTO_model_zoo)に遊びに行こう
kazuhitotakahashi
0
220
AWS re:Invent 2024 recap in 20min / JAWSUG 千葉 2025.1.14
shimy
1
100
今年一年で頑張ること / What I will do my best this year
pauli
1
220
Featured
See All Featured
Making Projects Easy
brettharned
116
6k
Writing Fast Ruby
sferik
628
61k
Designing Experiences People Love
moore
139
23k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Building Applications with DynamoDB
mza
93
6.2k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
What's in a price? How to price your products and services
michaelherold
244
12k
Docker and Python
trallard
43
3.2k
Music & Morning Musume
bryan
46
6.3k
The Cult of Friendly URLs
andyhume
78
6.1k
Transcript
A practical intro to snapshot testing
About me Freek Van der Herten Partner & developer at
SPATIE @freekmurze https://murze.be
About me phpantwerp.be Dries Vints @driesvints Frederick Vanbrabant @TheEdonian
Since 2003 Websites, applications and webshops Team 4 developers, 1
manager Specialization Laravel development
OPEN SOURCE SOFTWARE
± 120 packages on Packagist Laravel, Framework agnostic PHP ±
4 000 000 downloads in total, growing ±500 000 a month We create a lot of it Open source software
http://github-awards.com/users?type=world&language=php Open source software
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-nomadphp https://spatie.be/opensource https://murze.be https://murze.be/newsletter/
QUESTIONS?