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
Freek Van der Herten
July 20, 2017
Technology
180
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Snapshot testing (nomadphp)
Freek Van der Herten
July 20, 2017
More Decks by Freek Van der Herten
See All by Freek Van der Herten
Uncharted packages (ode aan de code)
freekmurze
0
72
Uncharted packages (Laravel Live Denmark)
freekmurze
0
270
I shall define this only once
freekmurze
0
490
An Introduction to Snapshot testing
freekmurze
0
580
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
930
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
え?フロントエンドエンジニアの ワイがインフラも!?
puku0x
1
680
SmartHR Engineering Team Deck
smarthr
1
2.3k
MulticaとPi Coding Agentで、小規模OSSを30本同時運用した流れ
eiei114
0
130
FPGAが実現する遠方宇宙の高空間分解能天体撮影 -大型地上望遠鏡の視力を補正する「補償光学」とは?-
komei_mt
0
280
LLM・AIエージェントシステムベストプラクティス
shibuiwilliam
6
1.4k
My broken English still works: speaking at global OSS events
naruoga
0
110
ハーレムエンジニアリング
kazuma777777
0
180
Genie Codeハンズオン基礎編
taka_aki
1
130
制約理論(ToC)入門 2026版
recruitengineers
PRO
8
2.4k
Apache Icebergインフラストラクチャ:ストレージ・カタログ・エンジンの選択肢とClouderaプラットフォームでの実装
tsugiyama
0
110
LanceDB入門
mocobeta
8
580
ボトムアップ文化が強い組織で セキュリティをどう根付かせていくかの現在進行形の話 / Making Security Stick in a Bottom-Up Organization
yamaguchitk333
0
240
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.5k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.3k
Accessibility Awareness
sabderemane
1
180
Navigating Weather and Climate Data
rabernat
0
480
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
66
57k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Documentation Writing (for coders)
carmenintech
77
5.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.3k
Being A Developer After 40
akosma
91
590k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
1.1k
The agentic SEO stack - context over prompts
schlessera
0
860
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?