SlideShare a Scribd company logo
Five Steps Towards Your Testing Dream
Lisa Gagarina
@lisa_gagarina
JPMorgan Chase & Co.
ReactEurope
Paris, 23-24th
May 2019
Step 1: Use static code analysis tools
What is wrong?
● Syntax and type errors at runtime
● Inconsistent code style
● Noisy, unnecessary unit tests
Step 1: Use static code analysis tools
What is wrong?
● Syntax and type errors at runtime
● Inconsistent code style
● Noisy, unnecessary unit tests
What to do?
● Use linter and static typing to
discover problems with your code
before you run it
● Use code formatter to automatically
style your code
Tools: ESLint, Prettier, TypeScript
Step 2: Gain more value from Jest snapshot testing
What is wrong?
● Too many, too big
● False negative failures
● Hard to code review
● Unclear intention
● False impression of good coverage
Step 2: Gain more value from Jest snapshot testing
What is wrong?
● Too many, too big
● False negative failures
● Hard to code review
● Unclear intention
● False impression of good coverage
What to do?
● Snapshot small static components
● Use inline and diff snapshots
● Use snapshots beyond React
Tools: Jest + ESLint (jest/no-large-snapshots,
jest/prefer-inline-snapshots),
npm snapshot-diff
What is wrong?
Step 3: Build up confidence in your tests
are hard to write
fail on non-breaking refactoring
pass when user experience is
broken
allow regressions and bugs to
creep in
TESTS
What is wrong?
Step 3: Build up confidence in your tests
are hard to write
fail on non-breaking refactoring
pass when user experience is
broken
allow regressions and bugs to
creep in
TESTS
What to do?
Write tests that:
● resemble how users interact
with your components
● are agnostic to implementation
details
● give you confidence in your
code
Tools: Jest + React Testing Library
What is wrong?
End-to-end tests are:
● hard to set up and write
● slow and flaky
● hard to debug
Step 4: Create reliable end-to-end tests
Step 4: Create reliable end-to-end tests
What to do?
● Run end-to-end tests in the same
run-loop as your application
● Control your application fully
● Debug efficiently
Tools: Cypress
What is wrong?
End-to-end tests are:
● hard to set up and write
● slow and flaky
● hard to debug
Step 5: Focus on what works for your project and
your team
Full recording of my talk at JavaScript Matters meetup in London:
https://skillsmatter.com/skillscasts/13054-javascript-matters
Learn more
● Kent C. Dodds: Write tests. Not too many. Mostly integration.
● Kent C. Dodds: Why I Never Use Shallow Rendering
● Kent C. Dodds: Testing JavaScript
● Lyudmil Latinov: Cypress vs. Selenium, is this the end of an era?
● Cypress: Key Differences
● Artem Sapegin: What’s wrong with snapshot tests
Learn more
Thank you
Lisa Gagarina
@lisa_gagarina
JPMorgan Chase & Co.
ReactEurope
Paris, 23-24th
May 2019

More Related Content

PDF
TDD — Are you sure you properly test code?
PPT
Lessons learned on software testing automation
PDF
Code Review: How and When
PPTX
Improving Code Quality Through Effective Review Process
DOCX
Initial Skills Analysis - Lewis Hartill
PDF
Boquet manager
PDF
How not to suck at unit tests
PDF
Who let the robot out? - Building high quality software with Continuous Integ...
TDD — Are you sure you properly test code?
Lessons learned on software testing automation
Code Review: How and When
Improving Code Quality Through Effective Review Process
Initial Skills Analysis - Lewis Hartill
Boquet manager
How not to suck at unit tests
Who let the robot out? - Building high quality software with Continuous Integ...

What's hot (17)

DOCX
Initail Skills Analysis
DOCX
Initialskillsanalysis
DOCX
Initial skills analysis
DOCX
Initial+skills+analysis+ (1)
DOCX
initial skills analysis
DOCX
Skills Analysis Sheet
DOCX
Initial Skills Analysis
DOCX
initial skills analysis
DOCX
Initial skills analysis
DOCX
Initial skills analysis
DOCX
Initial skills analysis Adam Gofton
DOCX
Initial Skills Analysis. Scott Appleyard
DOCX
Initial skills analysis
DOCX
Initial skills analysis
DOCX
Skills-Media
DOCX
Initial skills analysis
DOCX
Initialskillsanalysis
Initail Skills Analysis
Initialskillsanalysis
Initial skills analysis
Initial+skills+analysis+ (1)
initial skills analysis
Skills Analysis Sheet
Initial Skills Analysis
initial skills analysis
Initial skills analysis
Initial skills analysis
Initial skills analysis Adam Gofton
Initial Skills Analysis. Scott Appleyard
Initial skills analysis
Initial skills analysis
Skills-Media
Initial skills analysis
Initialskillsanalysis
Ad

Similar to Five steps towards your testing dream (20)

PDF
Don't let your tests slow you down
PDF
How to go about testing in React?
PPTX
MidwestJS Zero to Testing
PDF
Testing practicies not only in scala
ODP
Writing useful automated tests for the single page applications you build
PDF
Start with passing tests (tdd for bugs) v0.5 (22 sep 2016)
PDF
Test driven development and react js application go hand in hand
PPTX
Helping Programmers Write Better Tests
PPTX
The Amazing Bug Story
PDF
Intro to JavaScript Testing
PDF
Collaborating with Developers: How-to Guide for Test Engineers - By Gil Tayar
PDF
Testing in FrontEnd World by Nikita Galkin
PDF
JAVASCRIPT Test Driven Development & Jasmine
PDF
Top 5 Challenges in Software Testing and How to Overcome Them.pdf
PDF
Testing Strategies for Node.pdf
PDF
Test-Driven Development
PDF
An existential guide to testing React UIs
PDF
TDD: Develop, Refactor and Release With Confidence
PDF
Testing ReactJS Applications: Strategies and Best Practices
PPTX
4Developers 2015: Clean JavaScript code - only dream or reality - Sebastian Ł...
Don't let your tests slow you down
How to go about testing in React?
MidwestJS Zero to Testing
Testing practicies not only in scala
Writing useful automated tests for the single page applications you build
Start with passing tests (tdd for bugs) v0.5 (22 sep 2016)
Test driven development and react js application go hand in hand
Helping Programmers Write Better Tests
The Amazing Bug Story
Intro to JavaScript Testing
Collaborating with Developers: How-to Guide for Test Engineers - By Gil Tayar
Testing in FrontEnd World by Nikita Galkin
JAVASCRIPT Test Driven Development & Jasmine
Top 5 Challenges in Software Testing and How to Overcome Them.pdf
Testing Strategies for Node.pdf
Test-Driven Development
An existential guide to testing React UIs
TDD: Develop, Refactor and Release With Confidence
Testing ReactJS Applications: Strategies and Best Practices
4Developers 2015: Clean JavaScript code - only dream or reality - Sebastian Ł...
Ad

Recently uploaded (20)

PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
OOP with Java - Java Introduction (Basics)
PPT
Project quality management in manufacturing
PDF
Well-logging-methods_new................
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
additive manufacturing of ss316l using mig welding
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Sustainable Sites - Green Building Construction
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Welding lecture in detail for understanding
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
OOP with Java - Java Introduction (Basics)
Project quality management in manufacturing
Well-logging-methods_new................
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
additive manufacturing of ss316l using mig welding
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Sustainable Sites - Green Building Construction
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Automation-in-Manufacturing-Chapter-Introduction.pdf
Welding lecture in detail for understanding
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd

Five steps towards your testing dream

  • 1. Five Steps Towards Your Testing Dream Lisa Gagarina @lisa_gagarina JPMorgan Chase & Co. ReactEurope Paris, 23-24th May 2019
  • 2. Step 1: Use static code analysis tools What is wrong? ● Syntax and type errors at runtime ● Inconsistent code style ● Noisy, unnecessary unit tests
  • 3. Step 1: Use static code analysis tools What is wrong? ● Syntax and type errors at runtime ● Inconsistent code style ● Noisy, unnecessary unit tests What to do? ● Use linter and static typing to discover problems with your code before you run it ● Use code formatter to automatically style your code Tools: ESLint, Prettier, TypeScript
  • 4. Step 2: Gain more value from Jest snapshot testing What is wrong? ● Too many, too big ● False negative failures ● Hard to code review ● Unclear intention ● False impression of good coverage
  • 5. Step 2: Gain more value from Jest snapshot testing What is wrong? ● Too many, too big ● False negative failures ● Hard to code review ● Unclear intention ● False impression of good coverage What to do? ● Snapshot small static components ● Use inline and diff snapshots ● Use snapshots beyond React Tools: Jest + ESLint (jest/no-large-snapshots, jest/prefer-inline-snapshots), npm snapshot-diff
  • 6. What is wrong? Step 3: Build up confidence in your tests are hard to write fail on non-breaking refactoring pass when user experience is broken allow regressions and bugs to creep in TESTS
  • 7. What is wrong? Step 3: Build up confidence in your tests are hard to write fail on non-breaking refactoring pass when user experience is broken allow regressions and bugs to creep in TESTS What to do? Write tests that: ● resemble how users interact with your components ● are agnostic to implementation details ● give you confidence in your code Tools: Jest + React Testing Library
  • 8. What is wrong? End-to-end tests are: ● hard to set up and write ● slow and flaky ● hard to debug Step 4: Create reliable end-to-end tests
  • 9. Step 4: Create reliable end-to-end tests What to do? ● Run end-to-end tests in the same run-loop as your application ● Control your application fully ● Debug efficiently Tools: Cypress What is wrong? End-to-end tests are: ● hard to set up and write ● slow and flaky ● hard to debug
  • 10. Step 5: Focus on what works for your project and your team
  • 11. Full recording of my talk at JavaScript Matters meetup in London: https://skillsmatter.com/skillscasts/13054-javascript-matters Learn more
  • 12. ● Kent C. Dodds: Write tests. Not too many. Mostly integration. ● Kent C. Dodds: Why I Never Use Shallow Rendering ● Kent C. Dodds: Testing JavaScript ● Lyudmil Latinov: Cypress vs. Selenium, is this the end of an era? ● Cypress: Key Differences ● Artem Sapegin: What’s wrong with snapshot tests Learn more
  • 13. Thank you Lisa Gagarina @lisa_gagarina JPMorgan Chase & Co. ReactEurope Paris, 23-24th May 2019