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 (dpc)
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Freek Van der Herten
June 30, 2017
Technology
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Snapshot testing (dpc)
Freek Van der Herten
June 30, 2017
More Decks by Freek Van der Herten
See All by Freek Van der Herten
Uncharted packages (ode aan de code)
freekmurze
0
74
Uncharted packages (Laravel Live Denmark)
freekmurze
0
270
I shall define this only once
freekmurze
0
490
An Introduction to Snapshot testing
freekmurze
0
590
Event Sourcing In Laravel
freekmurze
0
290
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
890
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
940
A practical look at multitenancy in Laravel
freekmurze
1
410
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
800
Other Decks in Technology
See All in Technology
Azure Cost Management の FOCUS コストデータを迷わず読むための“3つの軸”
tetsuyaooooo
0
140
多層防御と最⼩権限で実現する、安全なAIエージェント設計パターン
lycorptech_jp
PRO
0
110
KAEN Company Deck
kaen
PRO
0
290
「重なり」は迎える側がつくる ― 人もAIエージェントも歓迎するプロダクトエンジニアリング ―
go0517go
PRO
0
220
APIセキュリティを組織で実現するには~注力する点と設計・実装に入れたい対策~
riiimparm
3
930
20260903 Tokyo Jazug Night #62 | Azure エンジニアよ、 その環境は本当にセキュアか?
olivia_0707
1
610
DINO-EdgeQuery:Edge-First Polygon Decoding for Building Footprint Extraction from Satellite Imagery
lehupa
0
140
Genie Code ワークショップ 基礎編 / Genie-Code-Workshop-fundamental
databricksjapan
PRO
0
340
KPIだけでは評価できないプロダクトが考えるべき Evalsという第二の評価系 / Beyond KPIs: Evals as a Second Evaluation Framework for Products #PdEConf
aki_iinuma
3
3.5k
【試作】IoT x AIエージェント
happysamurai294
0
120
魔法少女がClaude Codeを監視する / ccportal-deck
noriyukitakei
3
130
AndroidでHDRメディアを「壊さずに」扱う
chigichan24
0
380
Featured
See All Featured
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3k
Skip the Path - Find Your Career Trail
mkilby
1
220
Agile that works and the tools we love
rasmusluckow
331
22k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.9k
The untapped power of vector embeddings
frankvandijk
2
1.9k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
470
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
KATA
mclloyd
PRO
35
15k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
490
The Curious Case for Waylosing
cassininazir
1
490
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
590
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
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/