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
150
I shall define this only once
freekmurze
0
350
An Introduction to Snapshot testing
freekmurze
0
420
Event Sourcing In Laravel
freekmurze
0
210
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
720
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
770
A practical look at multitenancy in Laravel
freekmurze
1
300
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
670
Highlights Flare codebase (Laracon online)
freekmurze
0
420
Other Decks in Technology
See All in Technology
DenoでもViteしたい!インポートパスのエイリアスを指定してラクラクアプリ開発
bengo4com
2
2k
AWSの初級者向けAI・ML資格『AWS Certified AI Practitioner』の傾向と対策/So You Want To Pass AWS Certified AI Practitioner
quiver
0
610
スタサプ ForSCHOOLアプリのシンプルな設計
recruitengineers
PRO
3
720
The People First Approach to Engineering Success - DevNot 2024
zikriyeurkmez
0
180
From naive to advanced RAG: the complete guide
glaforge
0
360
I tried the newly introduced certification "Applied Skills" on Microsoft Learn
mappie_kochi
0
270
Efficient zero-copy networking using io_uring
ennael
PRO
0
410
令和最新版 Perlコーディングガイド
anatofuz
5
4.1k
エムスリー全チーム紹介資料 / Introduction of M3 All Teams
m3_engineering
1
340
Azure Verified Moduleを触って分かった注目ポイント/azure-verified-module-begin
mhrtech
1
520
Deno Deploy で Web Cache API を 使えるようになったので試した知見
toranoana
1
120
地域DXにおけるGrafana活用事例
wacky
0
260
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
296
20k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
BBQ
matthewcrist
85
9.2k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
The Cost Of JavaScript in 2023
addyosmani
43
5.9k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
12
1.6k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
2
310
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
327
21k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9k
Writing Fast Ruby
sferik
626
60k
Music & Morning Musume
bryan
46
6.1k
Producing Creativity
orderedlist
PRO
341
39k
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?