Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Maintainable Integration Testing in React
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Matija Marohnić
February 22, 2018
Programming
68
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Maintainable Integration Testing in React
Matija Marohnić
February 22, 2018
More Decks by Matija Marohnić
See All by Matija Marohnić
oxlint & oxfmt: linting and formatting from the future
silvenon
0
41
Goodbye jsdom/happy-dom, hello Vitest Browser Mode!
silvenon
0
32
Introduction to Remix
silvenon
0
170
Cypress vs. Playwright
silvenon
0
190
Studying Strapi: an open source head headless CMS
silvenon
0
63
CSS Specificity
silvenon
0
72
Make your JavaScript projects more accessible to newcomers
silvenon
0
99
React Hooks
silvenon
0
100
PostCSS
silvenon
0
67
Other Decks in Programming
See All in Programming
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
150
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
190
Webの地図
yosuke_furukawa
PRO
6
4.6k
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
2.8k
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
250
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
7.3k
スマート反転とウェブアクセシビリティ
camiha
0
210
アクセシビリティから考える情報設計
high_g_engineer
0
380
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
480
Jetpack Compose メカニズム
skydoves
0
440
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
170
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
150
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
520
ラッコキーワード サービス紹介資料
rakko
1
4.9M
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
280
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
The SEO identity crisis: Don't let AI make you average
varn
0
560
Mind Mapping
helmedeiros
1
360
Color Theory Basics | Prateek | Gurzu
gurzu
1
470
Transcript
None
Matija Marohnić @silvenon
Maintainable Integration Testing in React
Integration testing Unit testing End-to-end testing
Unit testing Are isolated parts of this feature working?
Integration testing Is this feature supposed to work?
End-to-end testing Does this feature actually work in a real
browser?
$$$ ¢ E2E Integration Unit Testing pyramid
•flaky/brittle •“too much of a hassle” •some features are hard
to test Case against frontend testing
•flaky → pass and fail with the same code •brittle
→ easily broken Flaky/brittle
•an afterthought, something to “deal with later” •not considered an
essential part of development “Too much of a hassle”
•e.g. some advanced APIs •async doesn’t help, it’s often about
timing •developers skip challenging tests, but never return Some features are hard to test
None
•integration tests focus on features •unit tests focus on implementation
details Why “mostly integration”?
How do you feel after writing a test?
None
–Me “A test is useless if you’re equally likely to
make a mistake in the implementation and the test itself.”
•usually developers strive towards 100% •important in libraries and APIs
•not really in frontend application code Test coverage
“You should write tests”
Testing in React
•simulating events •traversing through the tree •mounting in the DOM
or shallow rendering React test utilities
Mounting
Shallow rendering
Shallow vs. mount Unit vs. integration
•a complete testing framework •built-in jsdom •powerful assertions •easy mocking
Jest
•Enzyme •built on top of React’s test utilities •useful high-level
API •Nock •imitates a server Companion tools
Example: DataGrid
None
•opening a DataGrid displays features of the currently selected layer
Testing features Do Don’t •opening a DataGrid makes a certain API request
None
•creating a filter causes features to reduce to an expected
set Testing features Do Don’t •creating a filter displays a chip component
What about the API?
Nock
Nock
•battle-testing some modules in a cheap way •a disposable crutch
during development So when to unit test?
None
If the whole thing works together, chances are that its
parts are working as well