Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
snapshot testing (laraconus)
Freek Van der Herten
July 25, 2017
Programming
0
86
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
240
An Introduction to Snapshot testing
freekmurze
0
250
Event Sourcing In Laravel
freekmurze
0
160
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
530
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
540
A practical look at multitenancy in Laravel
freekmurze
1
250
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
500
Highlights Flare codebase (Laracon online)
freekmurze
0
220
Introducing Mailcoach
freekmurze
1
420
Other Decks in Programming
See All in Programming
ちょうぜつ改め21世紀ふつうのソフトウェア設計
tanakahisateru
7
6.5k
Findy - エンジニア向け会社紹介 / Findy Letter for Engineers
findyinc
2
42k
AWSにおける標的型Bot対策
hacomono
0
420
Use KMM to call the API of the National Tax Agency
akkeylab
0
300
Milestoner
bkuhlmann
1
250
Spring BootとKubernetesで実現する今どきのDevOps入門
xblood
0
350
Remote SSHで行うVS Codeリモートホスト開発とトラブルシューティング
smt7174
1
480
Qiita Night PHP 2023
fuwasegu
0
11k
Showkase、Paparazziを用いたビジュアルリグレッションテストの導入にチャレンジした話 / MoT TechTalk #15
mot_techtalk
0
120
ITエンジニア特化型Q&Aサイトteratailを 言語、DB、クラウドなど フルリプレイスした話
leveragestech
0
410
ipa-medit: Memory search and patch tool for IPA without Jailbreaking/ipa-medit-bh2022-europe
tkmru
0
130
良質な技術記事を量産する秘訣 / #MeetsPro
jnchito
10
3.4k
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
32
1.9k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
31
20k
The Language of Interfaces
destraynor
149
21k
Reflections from 52 weeks, 52 projects
jeffersonlam
338
18k
Making the Leap to Tech Lead
cromwellryan
117
7.7k
GraphQLの誤解/rethinking-graphql
sonatard
39
7.8k
Six Lessons from altMBA
skipperchong
15
2.3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
236
1.1M
What's in a price? How to price your products and services
michaelherold
233
9.7k
Building Adaptive Systems
keathley
27
1.3k
The Mythical Team-Month
searls
210
40k
What's new in Ruby 2.0
geeforr
336
30k
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?