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 (nomadphp)
Search
Freek Van der Herten
July 20, 2017
Technology
0
120
Snapshot testing (nomadphp)
Freek Van der Herten
July 20, 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
320
An Introduction to Snapshot testing
freekmurze
0
350
Event Sourcing In Laravel
freekmurze
0
190
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
660
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
680
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
330
Introducing Mailcoach
freekmurze
1
510
Other Decks in Technology
See All in Technology
Azureコストは水道代/The_47th_Tokyo_Jazug
aeonpeople
3
350
10分でわかるfreeeのQA
freee
0
210
サービスメッシュ環境における OpenTelemetry 活用 / OpenTelemetry in Service Mesh
k6s4i53rx
2
800
#51 “Empowering Azure Storage with RDMA”
cafenero_777
3
200
継続的テストモデルを実現するためにスリーアミーゴスを用いた10Xでのシフトレフトの事例
nihonbuson
2
110
Oracle Database で機械学習を始めよう! Oracle Machine Learning
oracle4engineer
PRO
1
140
2023 Japan AWS Jr.Championsに選出されての振り返りとこれから
hiropy877
1
130
Elementaryを用いたデータ品質の可視化とデータ基盤の運用改善
10xinc
6
1.4k
データ化エンジニアとしての1年を振り返る
sansantech
PRO
3
250
暗黙知を集積するプラットフォーム : 「健常者エミュレータ事例集」の取り組み
sora32127
1
160
HoneycombとOpenTelemetryでオブザーバビリティに入門してみる
sumiren
2
140
AMLD 2024 - Build Your Own GPT
donlelef
1
260
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
160
13k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
57
14k
Building Effective Engineering Teams - LeadDev
addyosmani
25
1.8k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
5
1.4k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
19
1.9k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
113
18k
What's new in Ruby 2.0
geeforr
335
31k
Happy Clients
brianwarren
91
6.3k
What’s in a name? Adding method to the madness
productmarketing
PRO
14
2.6k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
657
120k
Why You Should Never Use an ORM
jnunemaker
PRO
50
8.6k
Transcript
A practical intro to snapshot testing
About me Freek Van der Herten Partner & developer at
SPATIE @freekmurze https://murze.be
About me phpantwerp.be Dries Vints @driesvints Frederick Vanbrabant @TheEdonian
Since 2003 Websites, applications and webshops Team 4 developers, 1
manager Specialization Laravel development
OPEN SOURCE SOFTWARE
± 120 packages on Packagist Laravel, Framework agnostic PHP ±
4 000 000 downloads in total, growing ±500 000 a month We create a lot of it Open source software
http://github-awards.com/users?type=world&language=php Open source software
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-nomadphp https://spatie.be/opensource https://murze.be https://murze.be/newsletter/
QUESTIONS?