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 (nomadphp)
Freek Van der Herten
July 20, 2017
Technology
0
89
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
I shall define this only once
freekmurze
0
240
An Introduction to Snapshot testing
freekmurze
0
260
Event Sourcing In Laravel
freekmurze
0
160
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
530
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
550
A practical look at multitenancy in Laravel
freekmurze
1
250
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
510
Highlights Flare codebase (Laracon online)
freekmurze
0
220
Introducing Mailcoach
freekmurze
1
420
Other Decks in Technology
See All in Technology
はじめてスポンサー運営PMをやってみてわかった4つのこと
andpad
3
230
Hatena Engineer Seminar #23 「チームとプロダクトを育てる Mackerel 開発合宿」
arthur1
0
660
創業1年目のスタートアップでAWSコストを抑えるために取り組んでいること / How to Keep AWS Costs Down at a Startup
yuj1osm
3
2.2k
Logbii(ログビー) 会社紹介
logbii
0
180
スクラム導入して変わったチーム、組織のありかた
yumechi
0
310
IoTを始めたきっかけの話と個人でできるIoTの今後 / 新年LT会「私の愛するIoT 2023」
you
0
250
JAWS-UG 横浜 #54 資料
takakuni
0
220
ECテックカンファレンス2023 EC事業部のモバイル開発2023
tatsumi0000
0
350
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
3
16k
Dockerに疲れた人のためのLXDではじめるシステムコンテナ入門
devops_vtj
0
140
re:Invent発表のサービスを取り入れて加速する弥生のSecurity&Governance / accelerating YAYOI's Security and Governance with services announced at reinvent
yayoi_dd
0
160
日経電子版だけじゃない! 日経の新規Webメディアの開発 - NIKKEI Tech Talk #3
sztm
0
350
Featured
See All Featured
Web Components: a chance to create the future
zenorocha
304
40k
Visualization
eitanlees
129
12k
How New CSS Is Changing Everything About Graphic Design on the Web
jensimmons
214
12k
Design by the Numbers
sachag
271
18k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
29
8k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
2
410
Building Adaptive Systems
keathley
27
1.3k
Fireside Chat
paigeccino
16
1.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
22
1.7k
Put a Button on it: Removing Barriers to Going Fast.
kastner
56
2.5k
Happy Clients
brianwarren
90
5.8k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
44
14k
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?