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 (dpc)
Search
Freek Van der Herten
June 30, 2017
Technology
0
130
Snapshot testing (dpc)
Freek Van der Herten
June 30, 2017
Tweet
Share
More Decks by Freek Van der Herten
See All by Freek Van der Herten
Uncharted packages (Laravel Live Denmark)
freekmurze
0
140
I shall define this only once
freekmurze
0
350
An Introduction to Snapshot testing
freekmurze
0
420
Event Sourcing In Laravel
freekmurze
0
210
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
720
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
760
A practical look at multitenancy in Laravel
freekmurze
1
300
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
660
Highlights Flare codebase (Laracon online)
freekmurze
0
410
Other Decks in Technology
See All in Technology
LeSSはスクラムではない!?LeSSにおけるスクラムマスターの振る舞い方とは / Scrum Master Behavior in LeSS
toma_sm
0
200
【shownet.conf_】クロージングセッション
shownet
PRO
0
300
I tried the newly introduced certification "Applied Skills" on Microsoft Learn
mappie_kochi
0
150
Assisted reorganization of data structures
ennael
PRO
0
250
【shownet.conf_】ShowNet x 宇宙ネットワーク
shownet
PRO
0
400
AWSへのNIST SP800-171管理策 導入に向けての整備/20240930 Mitsutoshi Matsuo
shift_evolve
0
200
コード✕AIーソフトウェア開発者のための生成AI実践入門~
yuhattor
3
780
入社半年(合計1年)でGoogle Cloud 認定を全冠した秘訣🤫
risatube
0
150
【shownet.conf_】コンピューティング資源を統合した分散コンテナ基盤の進化
shownet
PRO
0
400
小さな勉強会の始め方、広げ方、あるいは友達の作り方 / How to Start, Grow, and Build Connections with Small Study Groups
ar_tama
6
2.7k
【shownet.conf_】放送局とShowNetが共創する、未来の放送システム ~Media over IP 特別企画の裏側~
shownet
PRO
0
350
エムスリーマネジメントチーム紹介資料 / Introduction of M3 Management Team
m3_engineering
0
280
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
131
8.8k
Thoughts on Productivity
jonyablonski
67
4.2k
Statistics for Hackers
jakevdp
796
220k
WebSockets: Embracing the real-time Web
robhawkes
59
7.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.7k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Designing Experiences People Love
moore
138
23k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
355
29k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Into the Great Unknown - MozCon
thekraken
31
1.4k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
How GitHub Uses GitHub to Build GitHub
holman
473
290k
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 ±450 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
QUESTIONS?
Thank you! https://speakerdeck.com/freekmurze/snapshot-testing-dpc https://spatie.be/opensource https://murze.be https://murze.be/newsletter/