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
Testing JavaScript
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Irfan Maulana
May 24, 2022
Programming
200
0
Share
Testing JavaScript
Intro to JavaScript testing
Irfan Maulana
May 24, 2022
More Decks by Irfan Maulana
See All by Irfan Maulana
Panduan untuk mempublikasikan kode ke publik
mazipan
0
170
Mengukur dan meningkatkan performa website
mazipan
1
250
Membuat Website Zaman Sekarang
mazipan
0
540
Kinerja Web 101 - Edisi 2022
mazipan
1
500
Layout Repaint & The Lessons Learned
mazipan
0
450
Bagaimana implementasi mockup design
mazipan
0
550
Memulai karir sebagai web programmer
mazipan
0
770
Membuat laporan kecepatan web untuk blog
mazipan
0
560
Bongkar Dapur Webnya #PHPID-OL
mazipan
0
550
Other Decks in Programming
See All in Programming
今さら聞けないCancellationToken
htkym
0
220
Old Dog, New Tricks: The Java 25 Reinvention - JNation
bazlur_rahman
0
140
Spec-Driven Development with AI-Agents: From High-Level Requirements to Working Software
antonarhipov
2
450
JavaDoc 再入門
nagise
0
280
Webフレームワークの ベンチマークについて
yusukebe
0
130
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
150
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
3.4k
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
350
ふつうのFeature Flag実践入門
irof
7
3.6k
さぁV100、メモリをお食べ・・・
nilpe
0
130
ビジネスモデルから紐解く、AI+型駆動開発
hirokiomote
2
5.2k
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
120
Featured
See All Featured
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
360
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
The SEO Collaboration Effect
kristinabergwall1
1
480
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
160
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.3k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
150
30 Presentation Tips
portentint
PRO
1
320
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
420
Crafting Experiences
bethany
1
170
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Transcript
Testing JavaScript By Irfan Maulana
Hi, I am Irfan Working at Tokopedia as Principal Engineer
for Web Platform Team. mazipan.space @Maz_Ipan
A process to verifying the correctness & validating the functional
features of the app being developed APPLICATION TESTING
Software Development Life Cycle
JAVASCRIPT APPLICATION Frontend Backend Handling UI functionality: web, apps, desktop
Handling business logic, data store connection A B We will focus on the Frontend for this session.
PERFORM APP TESTING MANUAL AUTOMATED
WHY DO WE NEED? Bugs are bad, and who gets
blamed? The developer. You know humans are bad at complex, repetitive tasks. Computers are very, very good at complex, repetitive tasks. A professional ships working code. Code that works. Code that is well tested.
Focused on input & output. Not interested about the things
happening inside. Involve testing of the internal structure, code, design & implementation. METHODOLOGIES BLACKBOX WHITEBOX
TESTING PROCESS 1. PLANNING 2. PREPARATION 3. EXECUTION 4. REPORTING
THE TESTING TYPES
PROVEN METHOD FOR TESTING APP
STATIC TEST To catch typos, errors, possible bugs as you
write the code. Tools: • ESLint + Prettier • CodeQL, Snyk, SonarQube
Very fast feedback Can not reproduce functional bugs faced by
users STATIC TEST: PRO & CONS We can mark it as mandatory Very beneficial in the development phase
UNIT TEST To verify that individual, isolated and smallest part
works as expected. Tools: • TestingLibrary.com
Fast feedback Need an extra effort to write UT UNIT
TEST: PRO & CONS Verify the correctness of the function Can not represent the bug when the unit integrated Can not represent real user interaction
INTEGRATION TEST To verify that several units work together in
harmony. Tools: • TestingLibrary.com
Verify most of user interactions Slower feedback than UT More
effort than UT INTEGRATION TEST: PRO & CONS Can not represent device variant Can not replicate using the real data
END-TO-END TEST A robot that behaves like a user to
click around the app and verify that it functions correctly. Tools: • Cypress • Nightwatch • TestCafe
Can use multiple device Very slow to executed Need the
biggest effort E2E TEST: PRO & CONS Can use real data Replicate real user
COMPARISON Static Test Unit Test Integration E2E Test 🚀 Speed
🟢 🟢 🟢 🟢 🟢 🟢 🟢 🟢 🟢 ⏰ Development time 🟢 🟢 🟢 🟢 🟢 🟢 🟢 🟢 🟢 🟢 💰 Cost 🟢 🟢 🟢 🟢 🟢 🟢 🟢 🟢 🟢 🟢 😎 Confidence 🟢 🟢 🟢 🟢 🟢 🟢 🟢 🟢 🟢 🟢 Read more on https://kentcdodds.com/blog/static-vs-unit-vs-integration-vs-e2e-tests
BEST ROI https://twitter.com/kentcdodds/status/960723172591992832
DEMO TIME!
CHECK THE CODE https://github.com/mazipan/react-testing-workshop Prerequisites: • Node.js
ASK ME!
CREDITS: This presentation template was created by Slidesgo, including icons
by Flaticon, and infographics & images by Freepik and illustrations by Stories. THANK YOU Please keep this slide for attribution.