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
0
140
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 (Laravel Live Denmark)
freekmurze
0
170
I shall define this only once
freekmurze
0
360
An Introduction to Snapshot testing
freekmurze
0
440
Event Sourcing In Laravel
freekmurze
0
220
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
740
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
800
A practical look at multitenancy in Laravel
freekmurze
1
320
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
680
Highlights Flare codebase (Laracon online)
freekmurze
0
440
Other Decks in Technology
See All in Technology
宇宙ベンチャーにおける最近の情シス取り組みについて
axelmizu
0
110
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
1
200
MLOps の現場から
asei
6
640
Snykで始めるセキュリティ担当者とSREと開発者が楽になる脆弱性対応 / Getting started with Snyk Vulnerability Response
yamaguchitk333
2
180
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
310
社内イベント管理システムを1週間でAKSからACAに移行した話し
shingo_kawahara
0
180
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
120
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
540
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
0
180
オプトインカメラ:UWB測位を応用したオプトイン型のカメラ計測
matthewlujp
0
170
Snowflake女子会#3 Snowpipeの良さを5分で語るよ
lana2548
0
230
DUSt3R, MASt3R, MASt3R-SfM にみる3D基盤モデル
spatial_ai_network
2
110
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Why Our Code Smells
bkeepers
PRO
335
57k
Designing Experiences People Love
moore
138
23k
What's in a price? How to price your products and services
michaelherold
243
12k
Documentation Writing (for coders)
carmenintech
66
4.5k
Become a Pro
speakerdeck
PRO
26
5k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
RailsConf 2023
tenderlove
29
940
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
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?