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
49
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
270
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
Amazon S3 Vectorsを使って資格勉強用AIエージェントを構築してみた
usanchuu
3
440
生成AI時代にこそ求められるSRE / SRE for Gen AI era
ymotongpoo
5
3k
FinTech SREのAWSサービス活用/Leveraging AWS Services in FinTech SRE
maaaato
0
130
AzureでのIaC - Bicep? Terraform? それ早く言ってよ会議
torumakabe
1
480
今日から始めるAmazon Bedrock AgentCore
har1101
4
400
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
Data Hubグループ 紹介資料
sansan33
PRO
0
2.7k
Digitization部 紹介資料
sansan33
PRO
1
6.8k
AIエージェントを開発しよう!-AgentCore活用の勘所-
yukiogawa
0
110
We Built for Predictability; The Workloads Didn’t Care
stahnma
0
140
制約が導く迷わない設計 〜 信頼性と運用性を両立するマイナンバー管理システムの実践 〜
bwkw
3
910
レガシー共有バッチ基盤への挑戦 - SREドリブンなリアーキテクチャリングの取り組み
tatsukoni
0
210
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
130
How to build a perfect <img>
jonoalderson
1
4.9k
Visualization
eitanlees
150
17k
How GitHub (no longer) Works
holman
316
140k
Side Projects
sachag
455
43k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
110
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
1
49
The SEO Collaboration Effect
kristinabergwall1
0
350
Building AI with AI
inesmontani
PRO
1
690
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3k
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?