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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Freek Van der Herten
July 20, 2017
Technology
0
170
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
60
Uncharted packages (Laravel Live Denmark)
freekmurze
0
250
I shall define this only once
freekmurze
0
470
An Introduction to Snapshot testing
freekmurze
0
550
Event Sourcing In Laravel
freekmurze
0
280
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
860
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
900
A practical look at multitenancy in Laravel
freekmurze
1
400
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
780
Other Decks in Technology
See All in Technology
AWS Systems Managerのハイブリッドアクティベーションを使用したガバメントクラウド環境の統合管理
toru_kubota
1
190
Databricks Appsで実現する社内向けAIアプリ開発の効率化
r_miura
0
120
LLMに何を任せ、何を任せないか
cap120
10
6.2k
来期の評価で変えようと思っていること 〜AI時代に変わること・変わらないこと〜
estie
0
120
Zephyr(RTOS)でOpenPLCを実装してみた
iotengineer22
0
160
Even G2 クイックスタートガイド(日本語版)
vrshinobi1
0
140
OpenClawでPM業務を自動化
knishioka
2
340
RGBに陥らないために -プロダクトの価値を届けるまで-
righttouch
PRO
0
130
JAWS DAYS 2026でAIの「もやっと」感が解消された話
smt7174
1
110
Cursor Subagentsはいいぞ
yug1224
2
120
ADK + Gemini Enterprise で 外部 API 連携エージェント作るなら OAuth の仕組みを理解しておこう
kaz1437
0
230
Why we keep our community?
kawaguti
PRO
0
340
Featured
See All Featured
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
94
Building Adaptive Systems
keathley
44
3k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Are puppies a ranking factor?
jonoalderson
1
3.2k
Balancing Empowerment & Direction
lara
5
1k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
93
Un-Boring Meetings
codingconduct
0
240
Game over? The fight for quality and originality in the time of robots
wayneb77
1
150
Faster Mobile Websites
deanohume
310
31k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
85
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?