Integration testing
Unit testing
End-to-end testing
Slide 5
Slide 5 text
Unit testing
Are isolated parts of this feature working?
Slide 6
Slide 6 text
Integration testing
Is this feature supposed to work?
Slide 7
Slide 7 text
End-to-end testing
Does this feature actually work in a real browser?
Slide 8
Slide 8 text
$$$
¢
E2E
Integration
Unit
Testing pyramid
Slide 9
Slide 9 text
•flaky/brittle
•“too much of a hassle”
•some features are hard to test
Case against
frontend testing
Slide 10
Slide 10 text
•flaky → pass and fail with the same code
•brittle → easily broken
Flaky/brittle
Slide 11
Slide 11 text
•an afterthought, something to “deal with later”
•not considered an essential part of development
“Too much of a hassle”
Slide 12
Slide 12 text
•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
Slide 13
Slide 13 text
No content
Slide 14
Slide 14 text
•integration tests focus on features
•unit tests focus on implementation details
Why “mostly integration”?
Slide 15
Slide 15 text
How do you feel
after writing a test?
Slide 16
Slide 16 text
No content
Slide 17
Slide 17 text
–Me
“A test is useless if you’re equally likely
to make a mistake in the implementation
and the test itself.”
Slide 18
Slide 18 text
•usually developers strive towards 100%
•important in libraries and APIs
•not really in frontend application code
Test coverage
Slide 19
Slide 19 text
“You should write tests”
Slide 20
Slide 20 text
Testing in React
Slide 21
Slide 21 text
•simulating events
•traversing through the tree
•mounting in the DOM or shallow rendering
React test utilities