Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Snapshot testing (dpc)
Freek Van der Herten
June 30, 2017
Technology
0
71
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
An Introduction to Snapshot testing
freekmurze
0
210
Event Sourcing In Laravel
freekmurze
0
140
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
440
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
1
480
A practical look at multitenancy in Laravel
freekmurze
1
240
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
440
Highlights Flare codebase (Laracon online)
freekmurze
0
170
Introducing Mailcoach
freekmurze
1
380
Highlights from the Flare codebase (Full Stack Ghent)
freekmurze
0
410
Other Decks in Technology
See All in Technology
Embedded SRE at Mercari
tcnksm
0
810
Oracle Database Technology Night #55 Oracle Autonomous Database 再入門
oracle4engineer
PRO
1
120
Devに力を授けたいSREのあゆみ / SRE that wants to empower developers
tocyuki
3
470
ITエンジニアを取り巻く環境とキャリアパス / A career path for Japanese IT engineers
takatama
0
580
THETA Xの登場はジオ業界を変えるか?
furuhashilab
0
160
Stripe Search APIを利用した、LINEとStripeの顧客情報連携/line-dc-202205
stripehideokamoto
0
120
開発者のための GitHub Organization の安全な運用と 継続的なモニタリング
flatt_security
3
3.4k
動画配信技術について
yaminoma
0
210
CADDi HCMC Technology Center
caddi_eng
0
250
Babylon.js で簡単 WebXR
yuhara0928
2
990
モデリング、コンテキスト トランジション +1 / Data modeling
ishiayaya
0
110
AWSの基礎を学ぼうで学んだ9種類のDBを勝手にふりかえる
98lerr
2
720
Featured
See All Featured
Design by the Numbers
sachag
271
17k
Adopting Sorbet at Scale
ufuk
63
7.5k
Why Our Code Smells
bkeepers
PRO
324
54k
Git: the NoSQL Database
bkeepers
PRO
415
59k
Making Projects Easy
brettharned
98
4.3k
Writing Fast Ruby
sferik
612
57k
BBQ
matthewcrist
74
7.9k
The Brand Is Dead. Long Live the Brand.
mthomps
45
2.7k
The Straight Up "How To Draw Better" Workshop
denniskardys
225
120k
Designing on Purpose - Digital PM Summit 2013
jponch
106
5.6k
A better future with KSS
kneath
225
15k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
224
49k
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/