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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Freek Van der Herten
July 20, 2017
Technology
0
160
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 (ode aan de code)
freekmurze
0
52
Uncharted packages (Laravel Live Denmark)
freekmurze
0
240
I shall define this only once
freekmurze
0
460
An Introduction to Snapshot testing
freekmurze
0
530
Event Sourcing In Laravel
freekmurze
0
280
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
850
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
890
A practical look at multitenancy in Laravel
freekmurze
1
390
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
770
Other Decks in Technology
See All in Technology
コミュニティが変えるキャリアの地平線:コロナ禍新卒入社のエンジニアがAWSコミュニティで見つけた成長の羅針盤
kentosuzuki
0
140
生成AIを活用した音声文字起こしシステムの2つの構築パターンについて
miu_crescent
PRO
3
250
生成AIと余白 〜開発スピードが向上した今、何に向き合う?〜
kakehashi
PRO
1
240
22nd ACRi Webinar - ChipTip Technology Eric-san's slide
nao_sumikawa
0
120
OCI Database Management サービス詳細
oracle4engineer
PRO
1
7.5k
通話データから価値を生む 生成AIデータ基盤の実践 / CO-LAB_Tech_Night
sansan_randd
0
100
Codex 5.3 と Opus 4.6 にコーポレートサイトを作らせてみた / Codex 5.3 vs Opus 4.6
ama_ch
0
260
AIエージェントに必要なのはデータではなく文脈だった/ai-agent-context-graph-mybest
jonnojun
1
590
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
56
47k
30分でわかる「ネットワーク図の描き方入門」/infraengbooks56
corestate55
1
300
ECSネイティブのBlue/Green デプロイを攻略しよう ~CodeDeployとの違いから、デプロイフロー実装まで~
ideaws
2
260
AWS DevOps Agent x ECS on Fargate検証 / AWS DevOps Agent x ECS on Fargate
kinunori
3
390
Featured
See All Featured
WCS-LA-2024
lcolladotor
0
460
It's Worth the Effort
3n
188
29k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Believing is Seeing
oripsolob
1
65
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
89
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Designing for humans not robots
tammielis
254
26k
What does AI have to do with Human Rights?
axbom
PRO
0
2k
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
Evolving SEO for Evolving Search Engines
ryanjones
0
130
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?