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
370
An Introduction to Snapshot testing
freekmurze
0
450
Event Sourcing In Laravel
freekmurze
0
220
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
750
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
810
A practical look at multitenancy in Laravel
freekmurze
1
320
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
690
Highlights Flare codebase (Laracon online)
freekmurze
0
450
Other Decks in Programming
See All in Programming
Androidアプリの One Experience リリース
nein37
0
510
ISUCON14感想戦で85万点まで頑張ってみた
ponyo877
0
150
Jaspr Dart Web Framework 박제창 @Devfest 2024
itsmedreamwalker
0
130
テストケースの名前はどうつけるべきか?
orgachem
PRO
1
180
テストコード書いてみませんか?
onopon
2
280
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
240
Fibonacci Function Gallery - Part 2
philipschwarz
PRO
0
200
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
130
traP の部内 ISUCON とそれを支えるポータル / PISCON Portal
ikura_hamu
0
110
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
260
Androidアプリのモジュール分割における:x:commonを考える
okuzawats
1
260
103 Early Hints
sugi_0000
1
320
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Code Reviewing Like a Champion
maltzj
521
39k
The Invisible Side of Design
smashingmag
299
50k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
940
Become a Pro
speakerdeck
PRO
26
5.1k
The Pragmatic Product Professional
lauravandoore
32
6.3k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Building Applications with DynamoDB
mza
92
6.1k
Thoughts on Productivity
jonyablonski
68
4.4k
Designing for humans not robots
tammielis
250
25k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
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?