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 (laraconus)
Search
Freek Van der Herten
July 25, 2017
Programming
0
100
snapshot testing (laraconus)
Freek Van der Herten
July 25, 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 Programming
See All in Programming
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
2
380
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
200
talk-with-local-llm-with-web-streams-api
kbaba1001
0
180
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
110
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
750
良いユニットテストを書こう
mototakatsu
7
2.2k
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
220
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1030
460k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Adopting Sorbet at Scale
ufuk
73
9.1k
Unsuck your backbone
ammeep
669
57k
Docker and Python
trallard
42
3.1k
Speed Design
sergeychernyshev
25
670
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Transcript
A practical intro to snapshot testing
Pronouncing Dutch Michael 3/10 Jacob 1/10
Pronouncing Dutch Michael 9/10 Jacob 9/10
Drake
Frake
Pronouncing Dutch: Spatie Spa Sea
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-laraconus https://spatie.be/opensource https://murze.be https://murze.be/newsletter/
QUESTIONS?