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
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
54
Uncharted packages (Laravel Live Denmark)
freekmurze
0
250
I shall define this only once
freekmurze
0
460
An Introduction to Snapshot testing
freekmurze
0
540
Event Sourcing In Laravel
freekmurze
0
280
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
850
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
900
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
LINE Messengerの次世代ストレージ選定
lycorptech_jp
PRO
17
6.6k
Microsoft Fabric のワークスペースと容量の設計原則
ryomaru0825
2
220
Claude Codeはレガシー移行でどこまで使えるのか?
ak2ie
1
1.1k
「使いにくい」も「運用疲れ」も卒業する UIデザイナーとエンジニアが創る持続可能な内製開発
nrinetcom
PRO
1
770
Snowflakeデータ基盤で挑むAI活用 〜4年間のDataOpsの基礎をもとに〜
kaz3284
1
320
マイグレーションガイドに書いてないRiverpod 3移行話
taiju59
0
340
Snowflake Night #2 LT
taromatsui_cccmkhd
0
310
Databricks (と気合い)で頑張るAI Agent 運用
kameitomohiro
0
350
もう怖くないバックグラウンド処理 Background Tasks のすべて - Hakodate.swift #1
kantacky
0
250
男(監査)はつらいよ - Policy as CodeからAIエージェントへ
ken5scal
5
700
AIエンジニア Devin と歩む、自律型運用プロセスの構築
a2ito
0
530
AI Agentにおける評価指標とAgent GPA
tsho
1
260
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
77
5.3k
BBQ
matthewcrist
89
10k
Everyday Curiosity
cassininazir
0
150
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
63
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
RailsConf 2023
tenderlove
30
1.4k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
85
Joys of Absence: A Defence of Solitary Play
codingconduct
1
300
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
130
Evolving SEO for Evolving Search Engines
ryanjones
0
140
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
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?