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
98
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
I shall define this only once
freekmurze
0
330
An Introduction to Snapshot testing
freekmurze
0
360
Event Sourcing In Laravel
freekmurze
0
200
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
670
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
690
A practical look at multitenancy in Laravel
freekmurze
1
280
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
610
Highlights Flare codebase (Laracon online)
freekmurze
0
340
Introducing Mailcoach
freekmurze
1
520
Other Decks in Programming
See All in Programming
Git Lint
bkuhlmann
4
750
try!Swift Tokyo 2024 参加報告 LT
akidon0000
1
220
Amazon SQSコンシューマー疎結合への旅 - 出張! #DevelopersIO IT技術ブログの中の人が語る勉強会 #3
quiver
0
270
使ってみよう Azure AI Document Intelligence
kosmosebi
2
320
Tailwind CSSを本気でカスタマイズする方法
fsubal
13
5.3k
educure_カリキュラム生操作マニュアル.pdf
linew_official
0
810
PHPはいつから死んでいるかの調査
chiroruxx
1
400
"config" ってなんだ? / What is "config"?
okashoi
0
240
dbtのドメイン分割による データ基盤の改善とDigdagとの連携
sakama
0
350
Let's learn code review
riofujimon
2
420
Milestoner
bkuhlmann
1
410
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
810
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
225
17k
Producing Creativity
orderedlist
PRO
337
39k
Principles of Awesome APIs and How to Build Them.
keavy
121
16k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
241
1.2M
Fantastic passwords and where to find them - at NoRuKo
philnash
37
2.5k
Code Review Best Practice
trishagee
55
15k
BBQ
matthewcrist
80
8.8k
The Straight Up "How To Draw Better" Workshop
denniskardys
227
130k
What's new in Ruby 2.0
geeforr
337
31k
Typedesign – Prime Four
hannesfritz
36
2.1k
We Have a Design System, Now What?
morganepeng
43
6.8k
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?