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
62
Uncharted packages (Laravel Live Denmark)
freekmurze
0
250
I shall define this only once
freekmurze
0
480
An Introduction to Snapshot testing
freekmurze
0
560
Event Sourcing In Laravel
freekmurze
0
280
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
860
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
910
A practical look at multitenancy in Laravel
freekmurze
1
400
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
780
Other Decks in Technology
See All in Technology
昔はシンプルだった_AmazonS3
kawaji_scratch
0
340
EBS暗号化に失敗してEC2が動かなくなった話
hamaguchimmm
2
200
サイボウズ 開発本部採用ピッチ / Cybozu Engineer Recruit
cybozuinsideout
PRO
10
78k
Claude Code を安全に使おう勉強会 / Claude Code Security Basics
masahirokawahara
11
34k
QGISプラグイン CMChangeDetector
naokimuroki
1
410
マルチプロダクトの信頼性を効率良く保っていくために
kworkdev
PRO
0
160
260420_スマートホーム採用説明 - wakinchan
wakinchan
0
110
M5Stack CoreS3とZephyr(RTOS)で Edge AIっぽいことしてみた
iotengineer22
0
250
プラットフォームエンジニアリングの実践 - AWS コンテナサービスで構築する社内プラットフォーム / AWS Containers Platform Meetup #1
literalice
1
200
Keeping Ruby Running on Cygwin
fd0
0
160
[OAWTT26][THR1028] Oracle AI Database 26ai へのアップグレード:ベストプラクティスと最新情報
oracle4engineer
PRO
1
110
AI駆動1on1〜AIに自分を育ててもらう〜
yoshiakiyasuda
0
120
Featured
See All Featured
Done Done
chrislema
186
16k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
150
The World Runs on Bad Software
bkeepers
PRO
72
12k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Amusing Abliteration
ianozsvald
1
160
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Code Reviewing Like a Champion
maltzj
528
40k
Designing Experiences People Love
moore
143
24k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
310
Measuring & Analyzing Core Web Vitals
bluesmoon
9
810
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.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?