I often express negative attitude towards frontend tests that, amongst other things, contributed to me failing a couple of interviews. Tests can be incredibly useful, but unfortunately majority of tests I’ve seen in my career are meaningless. 1/4 4 atbildes

Kirill Korolyov
(2020-02-06 20:18:17)
@twitter
I often express negative attitude towards frontend tests that, amongst other things, contributed to me failing a couple of interviews. Tests can be incredibly useful, but unfortunately majority of tests I’ve seen in my career are meaningless. 1/4
Kirill Korolyov
(2020-02-06 20:18:17)
@twitter
A lot of them test implementation details that are very flaky and don't tell you anything about what the code actually does. Why do I care if some function gets called? Others cherrypick bits of code and put them together differently, ending up testing the test! 2/4
Kirill Korolyov
(2020-02-06 20:18:18)
@twitter
Ever-changing snapshot tests tend to be ignored during code reviews. And don't get me started on TDD. In the UI world this only works if you compare component's output to a screenshot coming from the designer, but I haven't seen anyone doing this. 3/4
Kirill Korolyov
(2020-02-06 20:18:18)
@twitter
Want to create meaningful tests? Use visual regression testing (Chromatic), stub as little as possible, test UIs by interacting with them as a user would (Cypress, react-testing-library), use a type system (make it impossible to represent impossible state). 4/4
Kirill Korolyov
(2020-02-07 13:18:56)
@twitter
Writing testable UIs is not about moving out logic into container components or breaking down the code into tiny units (with the sole intention of being able to test them) until they become overly trivial and meaningless. It’s about (surprise!) making your app accessible.

© 2009-2017 civciv ;)