Journey to Champion React & Front End Testing
"What a mouthful!" is what you might think when you came across this post's title. I am no expert in front-end testing, and this post is about my own journey in learning testing and never going to be a tutorial from a pro thing.
On my quest as a Front End Engineer specializes on React, I grow up to be a developer who treat test as an after-thought. Because who doesn't ? As a product developer who cherishes product releases and impact on users above anything else, testing would be my last thing to ponder. Testing tends to be the thing that developers hate to write, especially Front end! I did back-end development as well in the past using Golang and Ruby, and my experience with testing for back-end was not really painful. In fact, it was kinda fun. But when it comes to testing front-end on React using tools like Enzyme, ugh that's a pain in the neck!
The Obvious Benefit of Front-End Testing
Stating obvious benefit of doing testing. You know it, but you don't really do it!
Testing Pyramid and Testing Trophy
Based on Kent C Dodds' https://kentcdodds.com/blog/write-tests also based on Martin Folwer's https://martinfowler.com/bliki/TestPyramid.html
The pyramid is based on the assumption that broad-stack tests are expensive, slow, and brittle compared to more focused tests, such as unit tests. While this is usually true, there are exceptions. If my high level tests are fast, reliable, and cheap to modify - then lower-level tests aren't needed.
Test and Measure what Matters
Show that snapshotting everything does not work! Show that testing implementation detail is tiring and does not have a good testing return! Let's talk on ROI in testing!
My Own Take on Writing Nice Test
I love how Scrum do user stories. Using what we understand from a user story point of view and have a nice naming convention around it.