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
170
0
Share
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
66
Uncharted packages (Laravel Live Denmark)
freekmurze
0
260
I shall define this only once
freekmurze
0
480
An Introduction to Snapshot testing
freekmurze
0
570
Event Sourcing In Laravel
freekmurze
0
280
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
880
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
920
A practical look at multitenancy in Laravel
freekmurze
1
400
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
790
Other Decks in Technology
See All in Technology
Javaで学ぶSOLID原則
negima
1
130
GitHub Copilot のこれまでとこれから: From Copilot to Collaborative Agents
yuriemori
1
190
インフラが苦手でも大丈夫! 紙芝居 Kubernetes -WWGT 10周年編-
aoi1
1
130
TypeScript の型で副作用の実行順序を制御する
yanaemon
2
210
自作エディターをOSSにして分かった、一人に刺さる開発が世界を動かす理由
shinyasaita
1
400
TROCCOで始めるクラウドコストを民主化するためのFinOps
tk3fftk
1
160
ラズパイ & Picoで入門:Zephyr(RTOS)の環境構築からビルドまでの紹介
iotengineer22
0
240
RubyでRuby拡張を書いたらRubyより35倍速になったってどういうこと??
kazuho
3
620
【ハノーバーメッセ振り返りイベントat名古屋】データは集約からAI起点の収集に ~組織内・組織間でのデータ連携~
tanakaseiya
0
120
Harnessing the Power of Mocks and Stubs in PHPUnit / #laravellivejp
asumikam
0
590
Claude Code x Accounting
kawaguti
PRO
1
320
checker.tsにチキンレースを仕掛けてみた:型エラー(TS2589)が発生する境界線を求めて
hal_spidernight
1
200
Featured
See All Featured
Speed Design
sergeychernyshev
33
1.7k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.4k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
70
39k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
150
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
210
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
190
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?