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
150
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
190
I shall define this only once
freekmurze
0
390
An Introduction to Snapshot testing
freekmurze
0
480
Event Sourcing In Laravel
freekmurze
0
240
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
790
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
830
A practical look at multitenancy in Laravel
freekmurze
1
340
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
710
Highlights Flare codebase (Laracon online)
freekmurze
0
480
Other Decks in Technology
See All in Technology
10ヶ月かけてstyled-components v4からv5にアップデートした話
uhyo
2
130
【Oracle Cloud ウェビナー】ご希望のクラウドでOracle Databaseを実行〜マルチクラウド・ソリューション徹底解説〜
oracle4engineer
PRO
1
110
生成AIのユースケースをとにかく集めてまるっと学ぶ!/ all about generative ai usecases
gakumura
2
230
彩の国で始めよう。おっさんエンジニアから共有したい、当たり前のことを当たり前にする技術
otsuki
0
160
Aspire をカスタマイズしよう & Aspire 9.2
nenonaninu
0
170
読んで学ぶ Amplify Gen2 / Amplify と CDK の関係を紐解く #jawsug_tokyo
tacck
PRO
1
250
QA/SDETの現在と、これからの挑戦
imtnd
0
150
SmartHR プロダクトエンジニア求人ガイド_2025 / PdE job guide 2025
smarthr
0
170
PagerDuty×ポストモーテムで築く障害対応文化/Building a culture of incident response with PagerDuty and postmortems
aeonpeople
2
400
AIでめっちゃ便利になったけど、結局みんなで学ぶよねっていう話
kakehashi
PRO
1
380
品質文化を支える小さいクロスファンクショナルなチーム / Cross-functional teams fostering quality culture
toma_sm
0
150
Amazon CloudWatch を使って NW 監視を行うには
o11yfes2023
0
180
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
30
8.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
135
33k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
The Cost Of JavaScript in 2023
addyosmani
49
7.7k
A Tale of Four Properties
chriscoyier
158
23k
GitHub's CSS Performance
jonrohan
1030
460k
Mobile First: as difficult as doing things right
swwweet
223
9.6k
Code Review Best Practice
trishagee
67
18k
Side Projects
sachag
453
42k
StorybookのUI Testing Handbookを読んだ
zakiyama
29
5.7k
How to train your dragon (web standard)
notwaldorf
90
6k
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?