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
140
I shall define this only once
freekmurze
0
340
An Introduction to Snapshot testing
freekmurze
0
410
Event Sourcing In Laravel
freekmurze
0
210
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
710
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
750
A practical look at multitenancy in Laravel
freekmurze
1
290
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
650
Highlights Flare codebase (Laracon online)
freekmurze
0
400
Other Decks in Programming
See All in Programming
デザインシステムとコンポーネント指向によるフロントエンド開発プロセスの革新 / Innovation in Frontend Development Processes through Design Systems and Component-Oriented Architecture
nrslib
7
5.1k
マルチモジュールにおけるテスト最適化
fxwx23
0
190
1人で挑むSwiftコンパイラ 〜型システム入門編〜
s_shimotori
0
320
New Order in Cascade Sorting Order
mugi_uno
3
2.5k
Mastering AsyncSequence - 使う・作る・他のデザインパターン(クロージャ、Delegate など)から移行する
treastrain
4
1.5k
現代のVueとTypeScript - 型安全の活用術
minako__ph
4
3.1k
LangChainでWebサイトの内容取得やGitHubソースコード取得
shukob
0
130
Wallet API, Verifier APIで実現するIDカード on iPhoneの世界
shitamori1272
1
360
【TID2024】模擬講義:プログラマと一緒にゲームをデザインしてみよう!
akatsukigames_tech
0
420
座談会 「Strict ConcurrencyとSwift 6が開く新時代: 私たちはどう生きるか?」
shiz
4
8.5k
暴走のウホーレン 〜想いってのはvimrcにしないと伝わらないんだぜ〜 / iosdc_japan_2024
uhooi
1
240
全力の跳躍を捉える計測アプリを作る
ogijun2018
1
1.2k
Featured
See All Featured
Thoughts on Productivity
jonyablonski
66
4.2k
Git: the NoSQL Database
bkeepers
PRO
425
64k
How to train your dragon (web standard)
notwaldorf
85
5.6k
How STYLIGHT went responsive
nonsquared
93
5.1k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Documentation Writing (for coders)
carmenintech
65
4.3k
Navigating Team Friction
lara
183
13k
[RailsConf 2023] Rails as a piece of cake
palkan
45
4.6k
What the flash - Photography Introduction
edds
67
11k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
52k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
41
6.5k
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?